frepple::utils::PythonExtensionBase Class Reference

This is a base class for all Python extension types. More...

#include <utils.h>

Inheritance diagram for frepple::utils::PythonExtensionBase:
frepple::FlowPlan frepple::LoadPlan frepple::utils::Object frepple::utils::PythonExtension< T > frepple::utils::PythonExtension< BufferIterator > frepple::utils::PythonExtension< CalendarBucketIterator > frepple::utils::PythonExtension< CalendarEventIterator > frepple::utils::PythonExtension< CalendarIterator > frepple::utils::PythonExtension< CustomerIterator > frepple::utils::PythonExtension< DemandIterator > frepple::utils::PythonExtension< DemandPlanIterator > frepple::utils::PythonExtension< FlowIterator > frepple::utils::PythonExtension< FlowPlanIterator > frepple::utils::PythonExtension< FreppleCategory< T > > frepple::utils::PythonExtension< FreppleClass< ME, BASE > > frepple::utils::PythonExtension< ItemIterator > frepple::utils::PythonExtension< LoadIterator > frepple::utils::PythonExtension< LoadPlanIterator > frepple::utils::PythonExtension< LocationIterator > frepple::utils::PythonExtension< ME > frepple::utils::PythonExtension< OperationIterator > frepple::utils::PythonExtension< OperationPlanIterator > frepple::utils::PythonExtension< ProblemIterator > frepple::utils::PythonExtension< ResourceIterator > frepple::utils::PythonExtension< SetupMatrixIterator > frepple::utils::PythonExtension< SetupMatrixRuleIterator > frepple::utils::PythonExtension< SolverIterator >

List of all members.

Public Member Functions

virtual PyObject * call (const PythonObject &args, const PythonObject &kwds)
virtual int compare (const PyObject *other) const
virtual PyObject * getattro (const Attribute &attr)
void initType (PyTypeObject *t)
void initType (const MetaClass *t)
virtual PyObject * iternext ()
 PythonExtensionBase ()
virtual int setattro (const Attribute &attr, const PythonObject &field)
virtual PyObject * str () const
virtual ~PythonExtensionBase ()

Static Protected Member Functions

static PythonTyperegisterPythonType (int, const type_info *)

Static Protected Attributes

static vector< PythonType * > table

Detailed Description

This is a base class for all Python extension types.

When creating you own extensions, inherit from the PythonExtension template class instead of this one.

It inherits from the PyObject C struct, defined in the Python C API.
These functions aren't called directly from Python. Python first calls a handler C-function and the handler function will use a virtual call to run the correct C++-method.

Our extensions don't use the usual Python heap allocator. They are created and initialized with the regular C++ new and delete. A special deallocator is called from Python to delete objects when their reference count reaches zero.

Definition at line 3162 of file utils.h.


Constructor & Destructor Documentation

frepple::utils::PythonExtensionBase::PythonExtensionBase (  )  [inline]

Default constructor

Definition at line 3166 of file utils.h.

virtual frepple::utils::PythonExtensionBase::~PythonExtensionBase (  )  [inline, virtual]

Destructor.

Definition at line 3169 of file utils.h.


Member Function Documentation

virtual PyObject* frepple::utils::PythonExtensionBase::call ( const PythonObject args,
const PythonObject kwds 
) [inline, virtual]

Default call method.
Subclasses are expected to implement an override if the type supports calls.

Definition at line 3233 of file utils.h.

virtual int frepple::utils::PythonExtensionBase::compare ( const PyObject *  other  )  const [inline, virtual]
virtual PyObject* frepple::utils::PythonExtensionBase::getattro ( const Attribute attr  )  [inline, virtual]
void frepple::utils::PythonExtensionBase::initType ( PyTypeObject *  t  )  [inline]

Initialize the object to a certain Python type.

Definition at line 3184 of file utils.h.

void frepple::utils::PythonExtensionBase::initType ( const MetaClass t  )  [inline]

Initialize the object to a certain Python type.

Definition at line 3178 of file utils.h.

virtual PyObject* frepple::utils::PythonExtensionBase::iternext (  )  [inline, virtual]

Default iternext method.
Subclasses are expected to implement an override if the type supports iteration.

Definition at line 3223 of file utils.h.

PythonType * frepple::utils::PythonExtensionBase::registerPythonType ( int  size,
const type_info *  t 
) [static, protected]

Definition at line 446 of file pythonutils.cpp.

virtual int frepple::utils::PythonExtensionBase::setattro ( const Attribute attr,
const PythonObject field 
) [inline, virtual]
virtual PyObject* frepple::utils::PythonExtensionBase::str (  )  const [inline, virtual]

Member Data Documentation

vector< PythonType * > frepple::utils::PythonExtensionBase::table [static, protected]

Definition at line 3250 of file utils.h.


The documentation for this class was generated from the following files:

Generated on 16 Apr 2010 for frePPLe by  doxygen 1.6.1