|
Adonthell
0.4
|
Stores the C++ <-> Python callback binding. More...
#include <py_callback.h>
Public Member Functions | |
| py_callback () | |
| Default ctor,. More... | |
| py_callback (PyObject *func, PyObject *args) | |
| Constructor that assigns a function and its arguments to the callback. More... | |
| ~py_callback () | |
| Destructor. More... | |
Executing the callback | |
| void | callback_func0 () |
| Calls the python function without arguments. More... | |
| bool | callback_func0ret () |
| Calls the python function and returns bool. More... | |
| void | callback_func1 (int arg) |
| Calls the python function with an integer. More... | |
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. More... | |
| void | put_state (ogzstream &out) const |
| Saves the callback and it's arguments to file. More... | |
| bool | get_state (igzstream &in) |
| Restores the callback from a file. More... | |
Stores the C++ <-> Python callback binding.
Definition at line 41 of file py_callback.h.
| py_callback::py_callback | ( | ) |
Default ctor,.
Definition at line 37 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 44 of file py_callback.cc.
| py_callback::~py_callback | ( | ) |
Destructor.
Definition at line 53 of file py_callback.cc.
| void py_callback::callback_func0 | ( | ) |
Calls the python function without arguments.
Definition at line 60 of file py_callback.cc.
| bool py_callback::callback_func0ret | ( | ) |
Calls the python function and returns bool.
Definition at line 68 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 82 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 94 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 120 of file py_callback.cc.
|
static |
When restoring a callback from file, instance has to point to the python instance (module or class) containing the callback.
Definition at line 122 of file py_callback.h.