Stores the C++ <-> Python callback binding. More...
#include <py_callback.h>
Public Member Functions | |
py_callback () | |
Default ctor,. | |
py_callback (PyObject *func, PyObject *args) | |
Constructor that assigns a function and its arguments to the callback. | |
~py_callback () | |
Destructor. | |
Executing the callback | |
void | callback_func0 () |
Calls the python function without arguments. | |
bool | callback_func0ret () |
Calls the python function and returns bool. | |
void | callback_func1 (int arg) |
Calls the python function with an integer. | |
Loading / Saving | |
| |
static PyObject * | instance = NULL |
When restoring a callback from file, instance has to point to the python instance (module or class) containing the callback. | |
void | put_state (ogzstream &out) const |
Saves the callback and it's arguments to file. | |
bool | get_state (igzstream &in) |
Restores the callback from a file. |
Stores the C++ <-> Python callback binding.
Definition at line 36 of file py_callback.h.
py_callback::py_callback | ( | ) |
Default ctor,.
Definition at line 33 of file py_callback.cc.
py_callback::py_callback | ( | PyObject * | func, | |
PyObject * | args | |||
) |
Constructor that assigns a function and its arguments to the callback.
func | function assigned to this callback. | |
args | Arguments passed to the function. |
Definition at line 40 of file py_callback.cc.
py_callback::~py_callback | ( | ) |
Destructor.
Definition at line 49 of file py_callback.cc.
void py_callback::callback_func0 | ( | ) |
Calls the python function without arguments.
Definition at line 56 of file py_callback.cc.
bool py_callback::callback_func0ret | ( | ) |
Calls the python function and returns bool.
Definition at line 64 of file py_callback.cc.
void py_callback::callback_func1 | ( | int | arg | ) |
Calls the python function with an integer.
arg | Integer value to pass to the callback |
Definition at line 78 of file py_callback.cc.
void py_callback::put_state | ( | ogzstream & | out | ) | const |
Saves the callback and it's arguments to file.
out | file where to save the callback. |
Definition at line 90 of file py_callback.cc.
bool py_callback::get_state | ( | igzstream & | in | ) |
Restores the callback from a file.
For that to work, the static py_callback::instance member has to point to the python instance containing the callback.
in | file to load the callback from. |
Definition at line 116 of file py_callback.cc.
PyObject * py_callback::instance = NULL [static] |
When restoring a callback from file, instance has to point to the python instance (module or class) containing the callback.
Definition at line 117 of file py_callback.h.