itom
Loading...
Searching...
No Matches
ito::PythonParamConversion Class Reference

Static methods to convert between Python objects and ito::ParamBase. More...

#include <pythontParamConversion.h>

Static Public Member Functions

static PyObject * ParamBaseToPyObject (const ito::ParamBase &param)
 
static SharedParamBasePointer PyObjectToParamBase (PyObject *obj, const char *name, ito::RetVal &retVal, int paramBaseType=0, bool strict=true)
 converts a given PyObject to an appropriate ito::ParamBase.
 

Static Private Member Functions

static void PyObjectToParamBaseDeleter (ito::ParamBase *param)
 special deleter for param, where the wrapped object is deleted, too.
 

Detailed Description

Static methods to convert between Python objects and ito::ParamBase.

Member Function Documentation

◆ ParamBaseToPyObject()

PyObject * ito::PythonParamConversion::ParamBaseToPyObject ( const ito::ParamBase & param)
static

converts ito::ParamBase to the most appropriate PyObject (returns nullptr, if conversion not possible / implemented).

This methods returns the given ParamBase object to an appropriate Python object. If the conversion is not possible or implemented, nullptr is returned and a Python exception is set.

Parameters
paramis the given ito::ParamBase parameter
Returns
The corresponding PyObject, whose content correspond to param.
See also
PyObjectToParamBase

◆ PyObjectToParamBase()

SharedParamBasePointer ito::PythonParamConversion::PyObjectToParamBase ( PyObject * obj,
const char * name,
ito::RetVal & retVal,
int paramBaseType = 0,
bool strict = true )
static

converts a given PyObject to an appropriate ito::ParamBase.

This method can be used as deleter callback for a shared pointer, covering an ito::ParamBase object. If this object is then deleted, this deleter callback will also finally deleted the internally stored object, if it is among one of the types ito::DataObject*, ito::PCLPointCloud or ito::PCLPolygonMesh.

If the conversion is related to references to dataObjects, point clouds or polygon meshes, a special deleter callback is assigned to the returned shared pointer, such that the referenced object is deleted, too, if the returned ParamBase is deleted within the shared pointer.

Parameters
objis the PyObject to be converted
nameis the name of the returned ParamBase
retValis used to store the success state of the conversion
paramBaseTypeis the desired type of the returned ParamBase, or 0, if the most appropriate type should be guessed (only implemented for some conversions / types).
strictif true, the conversion is only done if the given obj can be directly converted to the desired paramBaseType, else implicit conversions (e.g. from integer to string) are allowed, too.
See also
PyObjectToParamBaseDeleter

◆ PyObjectToParamBaseDeleter()

void ito::PythonParamConversion::PyObjectToParamBaseDeleter ( ito::ParamBase * param)
staticprivate

special deleter for param, where the wrapped object is deleted, too.

This method can be used as deleter callback for a shared pointer, covering an ito::ParamBase object. If this object is then deleted, this deleter callback will also finally deleted the internally stored object, if it is among one of the types ito::DataObject*, ito::PCLPointCloud or ito::PCLPolygonMesh.

This is necessary, since ito::ParamBase only hold a pointer (like a weak pointer) to these objects and will therefore not automatically deleted them.

Parameters
paramis the ito::ParamBase object to be deleted.
See also
PyObjectToParamBase

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