PLearn 0.1
|
***///*** More...
#include <PythonObjectWrapper.h>
Static Public Member Functions | |
static T * | convert (PyObject *pyobj, bool print_traceback) |
***///***
Definition at line 343 of file PythonObjectWrapper.h.
static T* PLearn::ConvertFromPyObject< T * >::convert | ( | PyObject * | pyobj, |
bool | print_traceback | ||
) | [inline, static] |
Definition at line 345 of file PythonObjectWrapper.h.
References PLearn::ConvertFromPyObject< T >::convert(), and PLERROR.
{ // Compile-time assertion: BOOST_STATIC_ASSERT((boost::is_base_of<Object, typename boost::remove_cv<T>::type>::value) || (boost::is_same<Object, typename boost::remove_cv<T>::type>::value)); //N.B.: If this assertion fails, it probably means that you are trying // to retrieve a pointer to something that is not an Object from // python. Only Object pointers are supported. Object* obj = ConvertFromPyObject<Object*>::convert(pyobj, print_traceback); if (T* tobj = dynamic_cast<T*>(obj)) return tobj; else PLERROR("Cannot convert object from python (type='%s').", TypeTraits<T*>::name().c_str()); return 0; // Silence compiler }