hpi::python_arglist Class Reference

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

#include <hpi_classes.h>

List of all members.

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.
 python_arglist (int _argc)
 the constructor is called with the number of arguments the argument list is meant to contain.
 ~python_arglist ()
 destructor, does cleanup
bool add (PyObject *python_arg)
 add a python object to the argument list.
bool add (const char *str)
 add a string to the argument list after converting it to an acceptable Python object.
PyObject * yield ()
 returns the generated PyObject Note that this will only succeed if the argument count is correct.

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  ) 
 

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 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().

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 have, and pArgs.

Referenced by add(), and hpi::callhpi().

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_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.

Referenced by hpi::callhpi().


Member Data Documentation

int hpi::python_arglist::argc [private]
 

Definition at line 93 of file hpi_classes.h.

Referenced by python_arglist(), and yield().

int hpi::python_arglist::have [private]
 

Definition at line 94 of file hpi_classes.h.

Referenced by add().

PyObject* hpi::python_arglist::pArgs [private]
 

Definition at line 92 of file hpi_classes.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Sep 30 01:25:47 2014 for Hugintrunk by  doxygen 1.3.9.1