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

#include <PythonObjectWrapper.h>

List of all members.

Static Public Member Functions

static VMField convert (PyObject *, bool print_traceback)

Detailed Description

template<>
struct PLearn::ConvertFromPyObject< VMField >

Definition at line 469 of file PythonObjectWrapper.h.


Member Function Documentation

VMField PLearn::ConvertFromPyObject< VMField >::convert ( PyObject *  pyobj,
bool  print_traceback 
) [static]

Definition at line 382 of file PythonObjectWrapper.cc.

References PLASSERT, and PLearn::PLPythonConversionError().

{
    PLASSERT(pyobj);
    PyObject* py_name = PyObject_GetAttrString(pyobj, const_cast<char*>("name"));
    if (!py_name)
        PLPythonConversionError("ConvertFromPyObject<VMField>: not a VMField (no 'name' attr.)",
                                pyobj, print_traceback);
    string name = ConvertFromPyObject<string>::convert(py_name, print_traceback);
    Py_DECREF(py_name);

    PyObject* py_fieldtype = PyObject_GetAttrString(pyobj, const_cast<char*>("fieldtype"));
    if(!py_fieldtype) 
        PLPythonConversionError("ConvertFromPyObject<VMField>: not a VMField (no 'fieldtype' attr.)",
                                pyobj, print_traceback);
    VMField::FieldType fieldtype = (VMField::FieldType)ConvertFromPyObject<int>::convert(py_fieldtype, print_traceback);
    Py_DECREF(py_fieldtype);

    return VMField(name, fieldtype);
}

Here is the call graph for this function:


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