This is the (logical) top class of the complete model. More...

#include <model.h>

Inheritance diagram for frepple::Plan:

Public Member Functions

void beginElement (XMLInput &, const Attribute &)
 
void endElement (XMLInput &, const Attribute &, const DataElement &)
 
PyObject * getattro (const Attribute &)
 
const DategetCurrent () const
 
const string & getDescription () const
 
const string & getName () const
 
virtual size_t getSize () const
 
const MetaClassgetType () const
 
int setattro (const Attribute &, const PythonObject &)
 
void setCurrent (Date)
 
void setDescription (const string &str)
 
void setName (const string &s)
 
virtual void solve (Solver &s, void *v=NULL) const
 
virtual void updateProblems ()
 
virtual void writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const
 
 ~Plan ()
 
- Public Member Functions inherited from frepple::Plannable
bool getChanged () const
 
bool getDetectProblems () const
 
PlannablegetEntity () const
 
 Plannable ()
 
void setChanged (bool b=true)
 
void setDetectProblems (bool b)
 
- Public Member Functions inherited from frepple::HasProblems
 HasProblems ()
 
virtual ~HasProblems ()
 
- Public Member Functions inherited from frepple::Solvable
virtual ~Solvable ()
 
- Public Member Functions inherited from frepple::utils::Object
virtual bool getHidden () const
 
 Object ()
 
virtual void setHidden (bool b)
 
virtual ~Object ()
 
- Public Member Functions inherited from frepple::utils::PythonExtensionBase
virtual PyObject * call (const PythonObject &args, const PythonObject &kwds)
 
virtual int compare (const PyObject *other) const
 
Py_ssize_t getReferenceCount () const
 
void initType (const MetaClass *t)
 
void initType (PyTypeObject *t)
 
virtual PyObject * iternext ()
 
 PythonExtensionBase ()
 
void resetReferenceCount ()
 
virtual PyObject * str () const
 
virtual ~PythonExtensionBase ()
 

Static Public Member Functions

static int initialize ()
 
static Planinstance ()
 
- Static Public Member Functions inherited from frepple::Plannable
static void computeProblems ()
 
- Static Public Member Functions inherited from frepple::HasProblems
static EntityIterator beginEntity ()
 
static EntityIterator endEntity ()
 
- Static Public Member Functions inherited from frepple::utils::Object
template<class T >
static PyObject * create (PyTypeObject *pytype, PyObject *args, PyObject *kwds)
 
template<class T >
static ObjectcreateDefault ()
 
template<class T >
static ObjectcreateString (const string &n)
 
static PyObject * toXML (PyObject *, PyObject *)
 

Static Public Attributes

static const MetaCategorymetadata
 

Additional Inherited Members

- Static Protected Member Functions inherited from frepple::utils::PythonExtensionBase
static PythonTyperegisterPythonType (int, const type_info *)
 
- Static Protected Attributes inherited from frepple::utils::PythonExtensionBase
static vector< PythonType * > table
 

Detailed Description

This is the (logical) top class of the complete model.

This is a singleton class: only a single instance can be created. The data model has other limitations that make it not obvious to support building multiple models/plans in memory of the same application: e.g. the operations, resources, problems, operationplans... etc are all implemented in static, global lists. An entity can't be simply linked with a particular plan if multiple ones would exist.

Definition at line 4341 of file model.h.

Constructor & Destructor Documentation

frepple::Plan::~Plan ( )

Destructor.

Warning
In multi threaded applications, the destructor is never called and the plan object leaks when we exit the application. In single-threaded applications this function is called properly, when the static plan variable is deleted.

Definition at line 58 of file plan.cpp.

Member Function Documentation

void frepple::Plan::beginElement ( XMLInput ,
const Attribute  
)
virtual

Called while restoring the model from an XML-file.
This is called for each element within the "this" element, for which the "this" element is immediate parent.
It is called when the open element tag is encountered.

Reimplemented from frepple::utils::Object.

Definition at line 117 of file plan.cpp.

void frepple::Plan::endElement ( XMLInput pIn,
const Attribute pAttr,
const DataElement pElement 
)
virtual

Reimplemented from frepple::Plannable.

Definition at line 102 of file plan.cpp.

PyObject * frepple::Plan::getattro ( const Attribute attr)
virtual

Default getattro method.
Subclasses are expected to implement an override if the type supports gettattro.

Reimplemented from frepple::utils::PythonExtensionBase.

Definition at line 134 of file plan.cpp.

const Date& frepple::Plan::getCurrent ( ) const
inline

Returns the current Date of the plan.

Definition at line 4383 of file model.h.

const string& frepple::Plan::getDescription ( ) const
inline

Returns the description of the plan.

Definition at line 4392 of file model.h.

const string& frepple::Plan::getName ( ) const
inline

Returns the plan name.

Definition at line 4377 of file model.h.

virtual size_t frepple::Plan::getSize ( ) const
inlinevirtual

Return the memory size of the object in bytes.

Implements frepple::utils::Object.

Definition at line 4417 of file model.h.

const MetaClass& frepple::Plan::getType ( ) const
inlinevirtual

This returns the type information on the object, a bit similar to the standard type_info information.

Implements frepple::utils::Object.

Definition at line 4415 of file model.h.

int frepple::Plan::initialize ( )
static

Initialize the class.

Definition at line 32 of file plan.cpp.

static Plan& frepple::Plan::instance ( )
inlinestatic

Return a pointer to the singleton plan object. The singleton object is created during the initialization of the library.

Definition at line 4366 of file model.h.

int frepple::Plan::setattro ( const Attribute attr,
const PythonObject field 
)
virtual

Default setattro method.
Subclasses are expected to implement an override if the type supports settattro.

Reimplemented from frepple::utils::PythonExtensionBase.

Definition at line 148 of file plan.cpp.

void frepple::Plan::setCurrent ( Date  l)

Updates the current date of the plan. This method can be relatively heavy in a plan where operationplans already exist, since the detection for BeforeCurrent problems needs to be rerun.

Definition at line 68 of file plan.cpp.

void frepple::Plan::setDescription ( const string &  str)
inline

Updates the description of the plan.

Definition at line 4395 of file model.h.

void frepple::Plan::setName ( const string &  s)
inline

Updates the plan name.

Definition at line 4380 of file model.h.

virtual void frepple::Plan::solve ( Solver s,
void *  v = NULL 
) const
inlinevirtual

This method basically solves the whole planning problem.

Reimplemented from frepple::Solvable.

Definition at line 4413 of file model.h.

virtual void frepple::Plan::updateProblems ( )
inlinevirtual

Called to update the list of problems. The function will only be called when:

  • the list of problems is being recomputed
  • AND, problem detection is enabled for this object
  • AND, the object has changed since the last problem computation

Implements frepple::HasProblems.

Definition at line 4410 of file model.h.

void frepple::Plan::writeElement ( XMLOutput o,
const Keyword tag,
mode  m = DEFAULT 
) const
virtual

This method writes out the model information. Depending on a flag in the XMLOutput object a complete model is written, or only the dynamic plan information.

Reimplemented from frepple::Plannable.

Definition at line 80 of file plan.cpp.

Member Data Documentation

const MetaCategory * frepple::Plan::metadata
static

Definition at line 4416 of file model.h.


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