PLearn 0.1
Static Public Member Functions
PLearn::ConvertFromPyObject< T * > Struct Template Reference

***///*** More...

#include <PythonObjectWrapper.h>

List of all members.

Static Public Member Functions

static T * convert (PyObject *pyobj, bool print_traceback)

Detailed Description

template<class T>
struct PLearn::ConvertFromPyObject< T * >

***///***

Definition at line 343 of file PythonObjectWrapper.h.


Member Function Documentation

template<class T >
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
    }

Here is the call graph for this function:


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines