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

#include <PythonObjectWrapper.h>

List of all members.

Static Public Member Functions

static RealRange convert (PyObject *, bool print_traceback)

Detailed Description

template<>
struct PLearn::ConvertFromPyObject< RealRange >

Definition at line 463 of file PythonObjectWrapper.h.


Member Function Documentation

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

Definition at line 348 of file PythonObjectWrapper.cc.

References PLASSERT, and PLearn::PLPythonConversionError().

{
    PLASSERT(pyobj);
    PyObject* py_leftbracket= PyObject_GetAttrString(pyobj, const_cast<char*>("leftbracket"));
    if(!py_leftbracket)
        PLPythonConversionError("ConvertFromPyObject<RealRange>: "
                                "not a RealRange (no 'leftbracket' attr.)",
                                pyobj, print_traceback);
    string leftbracket= ConvertFromPyObject<string>::convert(py_leftbracket, print_traceback);
    Py_DECREF(py_leftbracket);
    PyObject* py_low= PyObject_GetAttrString(pyobj, const_cast<char*>("low"));
    if(!py_low) 
        PLPythonConversionError("ConvertFromPyObject<RealRange>: "
                                "not a RealRange (no 'low' attr.)",
                                pyobj, print_traceback);
    real low= ConvertFromPyObject<real>::convert(py_low, print_traceback);
    Py_DECREF(py_low);
    PyObject* py_high= PyObject_GetAttrString(pyobj, const_cast<char*>("high"));
    if(!py_high) 
        PLPythonConversionError("ConvertFromPyObject<RealRange>: "
                                "not a RealRange (no 'high' attr.)",
                                pyobj, print_traceback);
    real high= ConvertFromPyObject<real>::convert(py_high, print_traceback);
    Py_DECREF(py_high);
    PyObject* py_rightbracket= PyObject_GetAttrString(pyobj, const_cast<char*>("rightbracket"));
    if(!py_rightbracket) 
        PLPythonConversionError("ConvertFromPyObject<RealRange>: "
                                "not a RealRange (no 'rightbracket' attr.)",
                                pyobj, print_traceback);
    string rightbracket= ConvertFromPyObject<string>::convert(py_rightbracket, print_traceback);
    Py_DECREF(py_rightbracket);
    return RealRange(leftbracket[0], low, high, rightbracket[0]);
}

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