Hugintrunk
0.1
|
helper class to generated PyObject from C/C++/hugin classes More...
#include <hpi_classes.h>
Public Member Functions | |
PyObject * | make_hsi_object (const char *hsi_type, void *hugin_value) |
general function to make a Python object from a hugin object. More... | |
python_arglist (int _argc) | |
the constructor is called with the number of arguments the argument list is meant to contain. More... | |
~python_arglist () | |
destructor, does cleanup More... | |
bool | add (PyObject *python_arg) |
add a python object to the argument list. More... | |
bool | add (const char *str) |
add a string to the argument list after converting it to an acceptable Python object. More... | |
PyObject * | yield () |
returns the generated PyObject Note that this will only succeed if the argument count is correct. More... | |
Private Attributes | |
PyObject * | pArgs |
int | argc |
int | have |
helper class to generated PyObject from C/C++/hugin classes
Definition at line 88 of file hpi_classes.h.
|
explicit |
the constructor is called with the number of arguments the argument list is meant to contain.
Note that you must add precisely this amount of arguments.
Definition at line 150 of file hpi_classes.cpp.
hpi::python_arglist::~python_arglist | ( | ) |
bool hpi::python_arglist::add | ( | PyObject * | python_arg | ) |
add a python object to the argument list.
This will only succeed if there is still space in the tuple. Note that you must have the Python object already to use this method.
Definition at line 160 of file hpi_classes.cpp.
References argc, have, and pArgs.
Referenced by add(), and hpi::callhpi().
bool hpi::python_arglist::add | ( | const char * | str | ) |
add a string to the argument list after converting it to an acceptable Python object.
This function can easily be copied and modified to apply to other data types, just pick the proper PyXXX_From_YYY Python API function.
Definition at line 170 of file hpi_classes.cpp.
References add().
PyObject * hpi::python_arglist::make_hsi_object | ( | const char * | hsi_type, |
void * | hugin_value | ||
) |
general function to make a Python object from a hugin object.
hsi_type | type of the passed object, must be passed either as the SWIG mangled name or as the human-readable name, so for a char*, "char*" or "_p_char" will work. |
hugin_value | pointer to object, this general case receives a void * and can make any type defined in the SWIG interface. |
Definition at line 127 of file hpi_classes.cpp.
Referenced by hpi::callhpi().
PyObject * hpi::python_arglist::yield | ( | ) |
returns the generated PyObject Note that this will only succeed if the argument count is correct.
Definition at line 183 of file hpi_classes.cpp.
References argc, have, and pArgs.
Referenced by hpi::callhpi().
|
private |
Definition at line 93 of file hpi_classes.h.
Referenced by add(), python_arglist(), and yield().
|
private |
Definition at line 94 of file hpi_classes.h.
|
private |
Definition at line 92 of file hpi_classes.h.
Referenced by add(), python_arglist(), yield(), and ~python_arglist().