py_callback Class Reference

Stores the C++ <-> Python callback binding. More...

#include <py_callback.h>

List of all members.

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.

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.


Detailed Description

Stores the C++ <-> Python callback binding.

Definition at line 36 of file py_callback.h.


Constructor & Destructor Documentation

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.

Parameters:
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.


Member Function Documentation

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.

Parameters:
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.

Note:
Currently, arguments have to be a tuple containing only integers and/or strings.
Parameters:
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.

Parameters:
in file to load the callback from.
Returns:
true if the callback could be restored, false otherwise
See also:
instance

Definition at line 116 of file py_callback.cc.


Member Data Documentation

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.

See also:
get_state

Definition at line 117 of file py_callback.h.


The documentation for this class was generated from the following files:

Generated on Wed Jun 18 16:55:41 2008 for Adonthell by  doxygen 1.5.6