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

#include <PythonObjectWrapper.h>

List of all members.

Static Public Member Functions

static CopiesMap convert (PyObject *, bool print_traceback)

Detailed Description

template<>
struct PLearn::ConvertFromPyObject< CopiesMap >

Definition at line 451 of file PythonObjectWrapper.h.


Member Function Documentation

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

Definition at line 312 of file PythonObjectWrapper.cc.

References PLASSERT, and PLearn::PLPythonConversionError().

{
    PLASSERT( pyobj );
    if (! PyDict_Check(pyobj))
        PLPythonConversionError("ConvertFromPyObject<CopiesMap>", 
                                pyobj, print_traceback);
#if PL_PYTHON_VERSION>=250
    Py_ssize_t pos = 0;
#else
    int pos = 0;
#endif
    CopiesMap copies;
    PyObject *key, *val;
    while(PyDict_Next(pyobj, &pos, &key, &val)) 
    {
        if(!PyCObject_Check(key))
            PLPythonConversionError("ConvertFromPyObject<CopiesMap> "
                                    "(key is not a cptr)", 
                                    key, print_traceback);
        if(!PyCObject_Check(val))
            PLPythonConversionError("ConvertFromPyObject<CopiesMap> "
                                    "(val is not a cptr)", 
                                    val, print_traceback);
        copies.insert(make_pair(PyCObject_AsVoidPtr(key),
                                PyCObject_AsVoidPtr(val)));
    }
    return copies;
}

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