VTK
Static Public Member Functions | Friends | List of all members
vtkPythonUtil Class Reference

#include <vtkPythonUtil.h>

Static Public Member Functions

static const char * PythonicClassName (const char *classname)
 
static void AddClassToMap (PyObject *obj, const char *classname)
 
static PyObjectFindClass (const char *classname)
 
static PyObjectFindNearestBaseClass (vtkObjectBase *ptr)
 
static PyObjectGetObjectFromPointer (vtkObjectBase *ptr)
 
static void * SIPGetPointerFromObject (PyObject *obj, const char *classname)
 
static PyObjectGetObjectFromObject (PyObject *arg, const char *type)
 
static void AddObjectToMap (PyObject *obj, vtkObjectBase *anInstance)
 
static void RemoveObjectFromMap (PyObject *obj)
 
static PyVTKSpecialType * FindSpecialType (const char *classname)
 
static void AddNamespaceToMap (PyObject *o)
 
static void RemoveNamespaceFromMap (PyObject *o)
 
static PyObjectFindNamespace (const char *name)
 
static PyObjectBuildDocString (const char *docstring[])
 
static char * ManglePointer (const void *ptr, const char *type)
 
static void * UnmanglePointer (char *ptrText, int *len, const char *type)
 
static long VariantHash (const vtkVariant *variant)
 
static vtkObjectBaseGetPointerFromObject (PyObject *obj, const char *classname)
 
static PyObjectSIPGetObjectFromPointer (const void *ptr, const char *classname, bool is_new)
 
static PyVTKSpecialType * AddSpecialTypeToMap (PyTypeObject *pytype, PyMethodDef *methods, PyMethodDef *constructors, const char *docstring[], PyVTKSpecialCopyFunc copyfunc)
 
static void * GetPointerFromSpecialObject (PyObject *obj, const char *result_type, PyObject **newobj)
 
static void RegisterPythonCommand (vtkPythonCommand *)
 
static void UnRegisterPythonCommand (vtkPythonCommand *)
 

Friends

void vtkPythonUtilDelete ()
 
void vtkPythonUtilCreateIfNeeded ()
 

Detailed Description

Definition at line 42 of file vtkPythonUtil.h.

Member Function Documentation

static const char* vtkPythonUtil::PythonicClassName ( const char *  classname)
static

If the name is templated or mangled, converts it into a python-printable name.

static void vtkPythonUtil::AddClassToMap ( PyObject obj,
const char *  classname 
)
static

Add a PyVTKClass to the type lookup table, this allows us to later create object given only the class name.

static PyObject* vtkPythonUtil::FindClass ( const char *  classname)
static

Get information about a special VTK type, given the type name.

static PyObject* vtkPythonUtil::FindNearestBaseClass ( vtkObjectBase ptr)
static

For an VTK object whose class is not in the ClassMap, search the whole ClassMap to find out which class is the closest base class of the object. Returns a PyVTKClass.

static vtkObjectBase* vtkPythonUtil::GetPointerFromObject ( PyObject obj,
const char *  classname 
)
static

Extract the vtkObjectBase from a PyVTKObject. If the PyObject is not a PyVTKObject, or is not a PyVTKObject of the specified type, the python error indicator will be set. Special behavior: Py_None is converted to NULL without no error.

static PyObject* vtkPythonUtil::GetObjectFromPointer ( vtkObjectBase ptr)
static

Convert a vtkObjectBase to a PyVTKObject. This will first check to see if the PyVTKObject already exists, and create a new PyVTKObject if necessary. This function also passes ownership of the reference to the PyObject. Special behaviour: NULL is converted to Py_None.

static void* vtkPythonUtil::SIPGetPointerFromObject ( PyObject obj,
const char *  classname 
)
static

Extract the SIP wrapped object from a PyObject. If the conversion cannot be done, an error indicator is set. Special behavior: Py_None is converted to NULL without no error.

static PyObject* vtkPythonUtil::SIPGetObjectFromPointer ( const void *  ptr,
const char *  classname,
bool  is_new 
)
static

Convert a SIP wrapped object to a PyObject. Special behaviour: NULL is converted to Py_None.

static PyObject* vtkPythonUtil::GetObjectFromObject ( PyObject arg,
const char *  type 
)
static

Try to convert some PyObject into a PyVTKObject, currently conversion is supported for SWIG-style mangled pointer strings.

static void vtkPythonUtil::AddObjectToMap ( PyObject obj,
vtkObjectBase anInstance 
)
static

Add PyVTKObject/vtkObjectBase pairs to the internal mapping. This methods do not change the reference counts of either the vtkObjectBase or the PyVTKObject.

static void vtkPythonUtil::RemoveObjectFromMap ( PyObject obj)
static

Remove a PyVTKObject from the internal mapping. No reference counts are changed.

static PyVTKSpecialType* vtkPythonUtil::AddSpecialTypeToMap ( PyTypeObject *  pytype,
PyMethodDef *  methods,
PyMethodDef *  constructors,
const char *  docstring[],
PyVTKSpecialCopyFunc  copyfunc 
)
static

Add a special VTK type to the type lookup table, this allows us to later create object given only the class name.

static PyVTKSpecialType* vtkPythonUtil::FindSpecialType ( const char *  classname)
static

Get information about a special VTK type, given the type name.

static void* vtkPythonUtil::GetPointerFromSpecialObject ( PyObject obj,
const char *  result_type,
PyObject **  newobj 
)
static

Given a PyObject, convert it into a "result_type" object, where "result_type" must be a wrapped type. The C object is returned as a void *, which must be cast to a pointer of the desired type. If conversion was necessary, then the created python object is returned in "newobj", but if the original python object was already of the correct type, then "newobj" will be set to NULL. If a python exception was raised, NULL will be returned.

static void vtkPythonUtil::AddNamespaceToMap ( PyObject o)
static

Add a wrapped C++ namespace as a python module object. This allows the namespace to be retrieved and added to as necessary.

static void vtkPythonUtil::RemoveNamespaceFromMap ( PyObject o)
static

Remove a wrapped C++ namespace from consideration. This is called from the namespace destructor.

static PyObject* vtkPythonUtil::FindNamespace ( const char *  name)
static

Return an existing namespace, or NULL if it doesn't exist.

static PyObject* vtkPythonUtil::BuildDocString ( const char *  docstring[])
static

Utility function to build a docstring by concatenating a series of strings until a null string is found.

static char* vtkPythonUtil::ManglePointer ( const void *  ptr,
const char *  type 
)
static

Utility function for creating SWIG-style mangled pointer string.

static void* vtkPythonUtil::UnmanglePointer ( char *  ptrText,
int len,
const char *  type 
)
static

Utility function decoding a SWIG-style mangled pointer string.

static long vtkPythonUtil::VariantHash ( const vtkVariant variant)
static

Compute a hash for a vtkVariant.

static void vtkPythonUtil::RegisterPythonCommand ( vtkPythonCommand )
static

Register a vtkPythonCommand. Registering vtkPythonCommand instances ensures that when the interpreter is destroyed (and Py_AtExit() gets called), the vtkPythonCommand state is updated to avoid referring to dangling Python objects pointers. Note, this will not work with Py_NewInterpreter.

static void vtkPythonUtil::UnRegisterPythonCommand ( vtkPythonCommand )
static

Register a vtkPythonCommand. Registering vtkPythonCommand instances ensures that when the interpreter is destroyed (and Py_AtExit() gets called), the vtkPythonCommand state is updated to avoid referring to dangling Python objects pointers. Note, this will not work with Py_NewInterpreter.

Friends And Related Function Documentation

void vtkPythonUtilDelete ( )
friend
void vtkPythonUtilCreateIfNeeded ( )
friend

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