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, string) |
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 (const string &) 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 () | |
Static Public Member Functions | |
static PyObject * | getEvents (PyObject *, PyObject *, PyObject *) |
static int | initialize () |
Static Public Attributes | |
static const MetaCategory * | metadata |
Protected Member Functions | |
int | lowestPriority () const |
Detailed Description
This is the class used to represent variables that are varying over time.
Some example usages for calendars:
- A calendar defining the available capacity of a resource week by week.
- The minimum inventory desired in a buffer week by week.
- The working hours and holidays at a certain location.
Constructor & Destructor Documentation
frepple::Calendar::Calendar | ( | const string & | n | ) | [inline] |
frepple::Calendar::~Calendar | ( | ) |
Destructor, which cleans up the buckets too and all references to the calendar from the core model.
Definition at line 159 of file calendar.cpp.
Member Function Documentation
Calendar::Bucket * frepple::Calendar::addBucket | ( | Date | start, |
Date | end, | ||
string | name | ||
) |
Adds a new bucket to the list.
Definition at line 198 of file calendar.cpp.
BucketIterator frepple::Calendar::beginBuckets | ( | ) | const [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.
Reimplemented in frepple::CalendarPointer< T >.
Definition at line 378 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 317 of file calendar.cpp.
BucketIterator frepple::Calendar::endBuckets | ( | ) | const [inline] |
void frepple::Calendar::endElement | ( | XMLInput & | , |
const Attribute & | , | ||
const DataElement & | |||
) | [inline, virtual] |
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.
Reimplemented from frepple::utils::HasName< Calendar >.
Reimplemented in frepple::CalendarPointer< T >, and frepple::CalendarValue< T >.
Calendar::Bucket * frepple::Calendar::findBucket | ( | Date | d, |
bool | fwd = true |
||
) | const |
Returns the bucket where a certain date belongs to. A bucket will always be returned, i.e. the data structure is such that we all dates between infinitePast and infiniteFuture match with one (and only one) bucket.
Definition at line 259 of file calendar.cpp.
Calendar::Bucket * frepple::Calendar::findBucket | ( | const string & | d | ) | const |
Returns the bucket with a certain name. A NULL pointer is returned in case no bucket can be found with the given name.
Definition at line 283 of file calendar.cpp.
PyObject * frepple::Calendar::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.
Reimplemented in frepple::CalendarOperation, frepple::CalendarString, frepple::CalendarBool, frepple::CalendarInt, and frepple::CalendarDouble.
Definition at line 523 of file calendar.cpp.
virtual bool frepple::Calendar::getBool | ( | ) | const [inline, virtual] |
Convert the value of the calendar to a boolean value.
Reimplemented in frepple::CalendarString, frepple::CalendarPointer< T >, frepple::CalendarPointer< Operation >, frepple::CalendarValue< T >, frepple::CalendarValue< T >, frepple::CalendarValue< double >, frepple::CalendarValue< int >, frepple::CalendarValue< string >, frepple::CalendarValue< bool >, and frepple::CalendarValue< T >.
PyObject * frepple::Calendar::getEvents | ( | PyObject * | self, |
PyObject * | args, | ||
PyObject * | kwdict | ||
) | [static] |
Definition at line 900 of file calendar.cpp.
virtual size_t frepple::Calendar::getSize | ( | ) | const [inline, virtual] |
Return the memory size of the object in bytes.
Implements frepple::utils::Object.
Reimplemented in frepple::CalendarString.
virtual const MetaClass& frepple::Calendar::getType | ( | ) | const [inline, virtual] |
This returns the type information on the object, a bit similar to the standard type_info information.
Implements frepple::utils::Object.
Reimplemented in frepple::CalendarOperation, frepple::CalendarString, frepple::CalendarBool, frepple::CalendarInt, frepple::CalendarDouble, frepple::CalendarVoid, frepple::CalendarPointer< T >, frepple::CalendarPointer< Operation >, frepple::CalendarValue< T >, frepple::CalendarValue< double >, frepple::CalendarValue< int >, frepple::CalendarValue< string >, and frepple::CalendarValue< bool >.
int frepple::Calendar::initialize | ( | ) | [static] |
Reimplemented in frepple::CalendarOperation, frepple::CalendarString, frepple::CalendarBool, frepple::CalendarInt, frepple::CalendarDouble, and frepple::CalendarVoid.
Definition at line 45 of file calendar.cpp.
int frepple::Calendar::lowestPriority | ( | ) | const [inline, protected] |
void frepple::Calendar::removeBucket | ( | Calendar::Bucket * | bkt | ) |
Removes a bucket from the list.
Definition at line 232 of file calendar.cpp.
int frepple::Calendar::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.
Reimplemented in frepple::CalendarOperation, frepple::CalendarString, frepple::CalendarBool, frepple::CalendarInt, and frepple::CalendarDouble.
Definition at line 533 of file calendar.cpp.
void frepple::Calendar::writeElement | ( | XMLOutput * | , |
const Keyword & | , | ||
mode | = DEFAULT |
||
) | const [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::CalendarPointer< T >, and frepple::CalendarValue< T >.
Definition at line 291 of file calendar.cpp.
Member Data Documentation
const MetaCategory * frepple::Calendar::metadata [static] |
The documentation for this class was generated from the following files:
Documentation generated for frePPLe by
