#include <PyStore.h>
|
| Store () |
| Constructor with parameters: More...
|
|
| Store (const std::size_t bufSize) |
| Constructor with parameters: size of buffers. More...
|
|
| ~Store () |
| Destructor: More...
|
|
const PyObject * | pydict () const |
| retrieve the underlying python dictionary More...
|
|
std::size_t | bufferSize () const |
| retrieve the current buffer size More...
|
|
std::string | repr () |
| python representation More...
|
|
void | setBufferSize (std::size_t bufferSize) |
| reset the buffer size. More...
|
|
template<typename T > |
void | book (const std::string &key, const std::string &dataName) |
| retrieve the underlying python dictionary More...
|
|
template<typename T > |
void | fill (const std::string &key, const std::string &dataName, const T &data) |
| fill some already registered node with data More...
|
|
void | clear_store () |
| clear buckets (but keeps registered/booked keys around) More...
|
|
std::size_t | m_bufSize |
| the buffer size of all buckets (ie: the pre-reserved length of all PyArrays) More...
|
|
PyObject * | m_store |
| data store: a python dictionary More...
|
|
void | py_book (const std::string &key, const std::string &dataName, char dataType='d') |
| python API More...
|
|
void | py_fill (const std::string &key, const std::string &dataName, PyObject *data) |
|
void | book_impl (const std::string &key, const std::string &dataName, char dataType='d') |
| register a variable with the store More...
|
|
void | fill_impl (const std::string &key, const std::string &dataName, PyObject *data) |
| fill some already registered node with data More...
|
|
Definition at line 36 of file PyStore.h.
◆ Store() [1/2]
Constructor with parameters:
Definition at line 46 of file PyStore.cxx.
◆ Store() [2/2]
Py::Store::Store |
( |
const std::size_t |
bufSize | ) |
|
Constructor with parameters: size of buffers.
Definition at line 51 of file PyStore.cxx.
◆ ~Store()
◆ book()
template<typename T >
void Py::Store::book |
( |
const std::string & |
key, |
|
|
const std::string & |
dataName |
|
) |
| |
|
inline |
retrieve the underlying python dictionary
register a variable with the store
Definition at line 79 of file PyStore.h.
◆ book_impl()
void Py::Store::book_impl |
( |
const std::string & |
key, |
|
|
const std::string & |
dataName, |
|
|
char |
dataType = 'd' |
|
) |
| |
|
private |
register a variable with the store
Definition at line 123 of file PyStore.cxx.
130 std::cerr <<
"Store::book : Could not allocate a buffer for ["
131 <<
key << s_uri << dataName <<
"] !!\n";
139 std::cerr <<
"Store::book : Could not reset allocated buffer ["
140 <<
key << s_uri << dataName <<
"] !!\n"
141 <<
" buf: " <<
Py::repr( buf ) <<
"\n";
147 if ( PyDict_SetItemString(
m_store,
148 const_cast<char*
>((
key+s_uri+dataName).c_str()),
151 std::cerr <<
"Store::book : Could not create buffer at ["
152 <<
key << s_uri << dataName <<
"]\n"
153 <<
" buf: " <<
Py::repr( buf ) <<
"\n";
◆ bufferSize()
std::size_t Py::Store::bufferSize |
( |
| ) |
const |
|
inline |
retrieve the current buffer size
Definition at line 61 of file PyStore.h.
◆ clear_store()
void Py::Store::clear_store |
( |
| ) |
|
clear buckets (but keeps registered/booked keys around)
Definition at line 89 of file PyStore.cxx.
94 Py_XDECREF( buffers );
98 for (
int i = 0, iMax = PyList_GET_SIZE( buffers );
i < iMax; ++
i ) {
102 const int len = PyList_GET_SIZE( buf );
105 if ( PyList_SetSlice( buf, 0, len, (
PyObject *) NULL ) != 0 ) {
115 Py_DECREF( buffers );
◆ fill()
template<typename T >
void Py::Store::fill |
( |
const std::string & |
key, |
|
|
const std::string & |
dataName, |
|
|
const T & |
data |
|
) |
| |
|
inline |
fill some already registered node with data
Definition at line 91 of file PyStore.h.
◆ fill_impl()
void Py::Store::fill_impl |
( |
const std::string & |
key, |
|
|
const std::string & |
dataName, |
|
|
PyObject * |
data |
|
) |
| |
|
private |
fill some already registered node with data
Definition at line 159 of file PyStore.cxx.
165 const_cast<char*
>((
key+s_uri+dataName).c_str()) );
168 std::cerr <<
"Store::fill : Could not retrieve key ["
169 <<
key << s_uri << dataName <<
"] from store !!\n";
178 if ( !PyList_Check( buf ) ) {
179 std::cerr <<
"Store::fill : buffer at ["
180 <<
key << s_uri << dataName <<
"] is NOT a python array !!\n"
181 <<
" buf: " <<
Py::repr( buf ) <<
"\n";
190 if ( 0 != PyList_Append( buf,
data ) ) {
192 std::cerr <<
"Store::fill : could not fill buffer at ["
193 <<
key << s_uri << dataName <<
"] !!\n"
194 <<
" buf: " <<
Py::repr( buf ) <<
"\n"
◆ py_book()
void Py::Store::py_book |
( |
const std::string & |
key, |
|
|
const std::string & |
dataName, |
|
|
char |
dataType = 'd' |
|
) |
| |
|
inline |
◆ py_fill()
void Py::Store::py_fill |
( |
const std::string & |
key, |
|
|
const std::string & |
dataName, |
|
|
PyObject * |
data |
|
) |
| |
|
inline |
◆ pydict()
retrieve the underlying python dictionary
Definition at line 58 of file PyStore.h.
◆ repr()
std::string Py::Store::repr |
( |
| ) |
|
◆ setBufferSize()
void Py::Store::setBufferSize |
( |
std::size_t |
bufferSize | ) |
|
reset the buffer size.
A no-op if new buffer size is same as old or smaller than old
Definition at line 76 of file PyStore.cxx.
◆ m_bufSize
std::size_t Py::Store::m_bufSize |
|
private |
the buffer size of all buckets (ie: the pre-reserved length of all PyArrays)
Definition at line 141 of file PyStore.h.
◆ m_store
data store: a python dictionary
Definition at line 144 of file PyStore.h.
The documentation for this class was generated from the following files: