This is the class used to represent variables that are varying over time. More...
#include <model.h>
Classes | |
class | Bucket |
This class represents a time bucket as a part of a calendar. More... | |
class | BucketIterator |
An iterator class to go through all buckets of the calendar. More... | |
class | EventIterator |
An iterator class to go through all dates where the calendar value changes. More... | |
Public Member Functions | |
Bucket * | addBucket (Date, Date, int=1) |
BucketIterator | beginBuckets () const |
void | beginElement (XMLInput &, const Attribute &) |
Calendar (const string &n) | |
Bucket * | createBucket (const AttributeList &) |
BucketIterator | endBuckets () const |
void | endElement (XMLInput &pIn, const Attribute &pAttr, const DataElement &pElement) |
Bucket * | findBucket (Date d, bool fwd=true) const |
Bucket * | findBucket (int ident) const |
virtual PyObject * | getattro (const Attribute &) |
virtual bool | getBool () const |
virtual size_t | getSize () const |
virtual const MetaClass & | getType () const |
void | removeBucket (Bucket *bkt) |
virtual int | setattro (const Attribute &, const PythonObject &) |
void | writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const |
~Calendar () | |
![]() | |
int | compare (const PyObject *other) const |
void | endElement (XMLInput &pIn, const Attribute &pAttr, const DataElement &pElement) |
HasName (const string &n) | |
HasName (const char *n) | |
void | setName (const string &newname) |
virtual PyObject * | str () const |
~HasName () | |
![]() | |
TreeNode * | decrement () const |
const string & | getName () const |
TreeNode * | increment () const |
bool | operator< (const TreeNode &o) |
TreeNode (const string &n) | |
virtual | ~TreeNode () |
![]() | |
virtual bool | getHidden () const |
Object () | |
virtual void | setHidden (bool b) |
virtual | ~Object () |
![]() | |
virtual PyObject * | call (const PythonObject &args, const PythonObject &kwds) |
Py_ssize_t | getReferenceCount () const |
void | initType (const MetaClass *t) |
void | initType (PyTypeObject *t) |
virtual PyObject * | iternext () |
PythonExtensionBase () | |
void | resetReferenceCount () |
virtual | ~PythonExtensionBase () |
Static Public Member Functions | |
static PyObject * | addPythonBucket (PyObject *, PyObject *, PyObject *) |
static PyObject * | getEvents (PyObject *, PyObject *) |
static int | initialize () |
![]() | |
static Calendar * | add (const string &k, const MetaClass &cls) |
static Calendar * | add (Calendar *t) |
static Calendar * | add (Calendar *t, Calendar *hint) |
static iterator | begin () |
static void | clear () |
static bool | empty () |
static iterator | end () |
static Calendar * | find (const string &k) |
static Calendar * | findLowerBound (const string &k, bool *f=NULL) |
static Object * | reader (const MetaClass *cat, const AttributeList &in) |
static size_t | size () |
static void | verify () |
static void | writer (const MetaCategory *c, XMLOutput *o) |
![]() | |
template<class T > | |
static PyObject * | create (PyTypeObject *pytype, PyObject *args, PyObject *kwds) |
template<class T > | |
static Object * | createDefault () |
template<class T > | |
static Object * | createString (const string &n) |
static PyObject * | toXML (PyObject *, PyObject *) |
Static Public Attributes | |
static const MetaCategory * | metadata |
Protected Member Functions | |
int | lowestPriority () const |
Additional Inherited Members | |
![]() | |
static PythonType * | registerPythonType (int, const type_info *) |
![]() | |
static vector< PythonType * > | table |
This is the class used to represent variables that are varying over time.
Some example usages for calendars:
|
inline |
frepple::Calendar::~Calendar | ( | ) |
Destructor, which cleans up the buckets too and all references to the calendar from the core model.
Definition at line 163 of file calendar.cpp.
Calendar::Bucket * frepple::Calendar::addBucket | ( | Date | start, |
Date | end, | ||
int | id = 1 |
||
) |
Adds a new bucket to the list.
Definition at line 198 of file calendar.cpp.
|
static |
Find an existing bucket with a given identifier, or create a new one. If no identifier is passed, we always create a new bucket and automatically generate a unique identifier for it.
Definition at line 870 of file calendar.cpp.
|
inline |
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 453 of file calendar.cpp.
Calendar::Bucket * frepple::Calendar::createBucket | ( | const AttributeList & | atts | ) |
This is a factory method that creates a new bucket using the start date as the key field. The fields are passed as an array of character pointers.
This method is intended to be used to create objects when reading XML input data.
Definition at line 392 of file calendar.cpp.
|
inline |
|
inlinevirtual |
Called while restoring the model from an XML-file.
This is called when the corresponding close element tag is encountered, and the Data() member of pElement is valid.
Implements frepple::utils::Object.
Reimplemented in frepple::CalendarDouble.
Calendar::Bucket * frepple::Calendar::findBucket | ( | Date | d, |
bool | fwd = true |
||
) | const |
Returns the bucket where a certain date belongs to. A NULL pointer is returned when no bucket is effective.
Definition at line 308 of file calendar.cpp.
Calendar::Bucket * frepple::Calendar::findBucket | ( | int | ident | ) | const |
Returns the bucket with a certain identifier. A NULL pointer is returned in case no bucket can be found with the given identifier.
Definition at line 357 of file calendar.cpp.
|
virtual |
Default getattro method.
Subclasses are expected to implement an override if the type supports gettattro.
Reimplemented from frepple::utils::PythonExtensionBase.
Reimplemented in frepple::CalendarDouble.
Definition at line 806 of file calendar.cpp.
|
inlinevirtual |
Convert the value of the calendar to a boolean value.
Reimplemented in frepple::CalendarDouble.
|
static |
Definition at line 981 of file calendar.cpp.
|
inlinevirtual |
Return the memory size of the object in bytes.
Implements frepple::utils::Object.
|
inlinevirtual |
This returns the type information on the object, a bit similar to the standard type_info information.
Implements frepple::utils::Object.
Reimplemented in frepple::CalendarDouble.
|
static |
Definition at line 34 of file calendar.cpp.
|
inlineprotected |
void frepple::Calendar::removeBucket | ( | Calendar::Bucket * | bkt | ) |
Removes a bucket from the list.
Definition at line 208 of file calendar.cpp.
|
virtual |
Default setattro method.
Subclasses are expected to implement an override if the type supports settattro.
Reimplemented from frepple::utils::PythonExtensionBase.
Reimplemented in frepple::CalendarDouble.
Definition at line 816 of file calendar.cpp.
|
virtual |
Called while writing the model into an XML-file. The user class should write itself out, using the IOutStream members for its "simple" members and calling writeElement recursively for any contained objects. Not all classes are expected to implement this method. In instances of such a class can be created but can't be persisted. E.g. Command
Reimplemented from frepple::utils::Object.
Reimplemented in frepple::CalendarDouble.
Definition at line 365 of file calendar.cpp.
|
static |