Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
hpi::python_arglist Class Reference

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
 

Detailed Description

helper class to generated PyObject from C/C++/hugin classes

Definition at line 88 of file hpi_classes.h.

Constructor & Destructor Documentation

hpi::python_arglist::python_arglist ( int  _argc)
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.

References argc, and pArgs.

hpi::python_arglist::~python_arglist ( )

destructor, does cleanup

Definition at line 155 of file hpi_classes.cpp.

References pArgs.

Member Function Documentation

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.

Parameters
hsi_typetype 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_valuepointer 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().

Member Data Documentation

int hpi::python_arglist::argc
private

Definition at line 93 of file hpi_classes.h.

Referenced by add(), python_arglist(), and yield().

int hpi::python_arglist::have
private

Definition at line 94 of file hpi_classes.h.

Referenced by add(), and yield().

PyObject* hpi::python_arglist::pArgs
private

Definition at line 92 of file hpi_classes.h.

Referenced by add(), python_arglist(), yield(), and ~python_arglist().


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