This class implements a "sorted list" data structure, sorting "events" based on a date. More...
#include <timeline.h>
Classes | |
class | const_iterator |
This is bi-directional iterator through the timeline. More... | |
class | Event |
Base class for nodes in the timeline. More... | |
class | EventChangeOnhand |
A timeline event representing a change of the current value. More... | |
class | EventMaxQuantity |
A timeline event representing a change of the maximum target. More... | |
class | EventMinQuantity |
A timeline event representing a change of the minimum target. More... | |
class | iterator |
This is bi-directional iterator through the timeline. More... |
Public Member Functions | |
iterator | begin () |
iterator | begin (Event *e) |
const_iterator | begin () const |
const_iterator | begin (const Event *e) const |
bool | check () const |
bool | empty () const |
iterator | end () |
const_iterator | end () const |
void | erase (Event *) |
virtual double | getMax (Date d, bool inclusive=true) const |
virtual double | getMax (const Event *e, bool inclusive=true) const |
virtual EventMaxQuantity * | getMaxEvent (Date d, bool inclusive=true) const |
virtual double | getMin (Date d, bool inclusive=true) const |
virtual double | getMin (const Event *e, bool inclusive=true) const |
virtual EventMinQuantity * | getMinEvent (Date d, bool inclusive=true) const |
void | insert (Event *) |
void | insert (EventChangeOnhand *e, double qty, const Date &d) |
void | inspect (const string &name) const |
iterator | rbegin () |
const_iterator | rbegin () const |
int | size () const |
TimeLine () | |
void | update (EventChangeOnhand *, double, const Date &) |
Friends | |
class | Event |
This class implements a "sorted list" data structure, sorting "events" based on a date.
The data structure has slow insert scalability: O(n)
Moving data around in the structure is efficient though: O(1)
The class leverages the STL library and also follows its api.
The class used to instantiate a timeline must support the "bool operator < (TYPE)".
Note that the events store the quantity but NOT the date. We pick up the date from the template type. The reasoning for this choice is that the quantity requires more computation than the date and is worthwhile caching. The date field can be read efficiently from the parent type.
Definition at line 47 of file timeline.h.
|
inline |
Definition at line 225 of file timeline.h.
|
inline |
Definition at line 232 of file timeline.h.
|
inline |
Definition at line 233 of file timeline.h.
|
inline |
Definition at line 236 of file timeline.h.
|
inline |
Definition at line 237 of file timeline.h.
bool frepple::utils::TimeLine< type >::check | ( | ) | const |
This function is used to trace the consistency of the data structure.
Definition at line 585 of file timeline.h.
|
inline |
Definition at line 240 of file timeline.h.
|
inline |
Definition at line 235 of file timeline.h.
|
inline |
Definition at line 239 of file timeline.h.
void frepple::utils::TimeLine< type >::erase | ( | Event * | e | ) |
Definition at line 443 of file timeline.h.
|
inlinevirtual |
This functions returns the maximum valid at a certain date.
Definition at line 288 of file timeline.h.
|
inlinevirtual |
This functions returns the mimimum valid at a certain eveny.
Definition at line 299 of file timeline.h.
|
inlinevirtual |
This functions returns the maximum event valid at a certain date.
Definition at line 322 of file timeline.h.
|
inlinevirtual |
This functions returns the mimimum valid at a certain date.
Definition at line 265 of file timeline.h.
|
inlinevirtual |
This functions returns the mimimum valid at a certain event.
Definition at line 276 of file timeline.h.
|
inlinevirtual |
This functions returns the mimimum event valid at a certain date.
Definition at line 311 of file timeline.h.
void frepple::utils::TimeLine< type >::insert | ( | Event * | e | ) |
Definition at line 350 of file timeline.h.
|
inline |
Definition at line 242 of file timeline.h.
|
inline |
This function is used for debugging purposes.
It prints a header line, followed by the date, quantity and on_hand of all events in the timeline.
Definition at line 255 of file timeline.h.
|
inline |
Definition at line 234 of file timeline.h.
|
inline |
Definition at line 238 of file timeline.h.
|
inline |
Definition at line 226 of file timeline.h.
void frepple::utils::TimeLine< type >::update | ( | EventChangeOnhand * | e, |
double | newqty, | ||
const Date & | d | ||
) |
Definition at line 508 of file timeline.h.
|
friend |
Definition at line 49 of file timeline.h.