frepple::utils::TimeLine< type > Class Template Reference

This class implements a "sorted list" data structure, sorting "events" based on a date. More...

#include <timeline.h>

List of all members.

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

const_iterator begin (const Event *e) const
const_iterator begin () const
iterator begin (Event *e)
iterator begin ()
bool check () const
bool empty () const
const_iterator end () const
iterator end ()
void erase (Event *)
virtual double getMax (const Event *e, bool inclusive=true) const
virtual double getMax (Date d, bool inclusive=true) const
virtual EventMaxQuantitygetMaxEvent (Date d, bool inclusive=true) const
virtual double getMin (const Event *e, bool inclusive=true) const
virtual double getMin (Date d, bool inclusive=true) const
virtual EventMinQuantitygetMinEvent (Date d, bool inclusive=true) const
void insert (EventChangeOnhand *e, double qty, const Date &d)
void insert (Event *)
void inspect (const string &name) const
const_iterator rbegin () const
iterator rbegin ()
int size () const
 TimeLine ()
void update (EventChangeOnhand *, double, const Date &)

Friends

class Event

Detailed Description

template<class type>
class frepple::utils::TimeLine< type >

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 54 of file timeline.h.


Constructor & Destructor Documentation

template<class type>
frepple::utils::TimeLine< type >::TimeLine (  )  [inline]

Definition at line 238 of file timeline.h.


Member Function Documentation

template<class type>
const_iterator frepple::utils::TimeLine< type >::begin ( const Event e  )  const [inline]

Definition at line 250 of file timeline.h.

template<class type>
const_iterator frepple::utils::TimeLine< type >::begin (  )  const [inline]

Definition at line 249 of file timeline.h.

template<class type>
iterator frepple::utils::TimeLine< type >::begin ( Event e  )  [inline]

Definition at line 246 of file timeline.h.

template<class type>
iterator frepple::utils::TimeLine< type >::begin (  )  [inline]

Definition at line 245 of file timeline.h.

template<class type >
bool frepple::utils::TimeLine< type >::check (  )  const [inline]

This function is used to trace the consistency of the data structure.

Definition at line 566 of file timeline.h.

template<class type>
bool frepple::utils::TimeLine< type >::empty (  )  const [inline]

Definition at line 253 of file timeline.h.

template<class type>
const_iterator frepple::utils::TimeLine< type >::end (  )  const [inline]

Definition at line 252 of file timeline.h.

template<class type>
iterator frepple::utils::TimeLine< type >::end (  )  [inline]

Definition at line 248 of file timeline.h.

template<class type >
void frepple::utils::TimeLine< type >::erase ( Event e  )  [inline]

Definition at line 456 of file timeline.h.

template<class type>
virtual double frepple::utils::TimeLine< type >::getMax ( const Event e,
bool  inclusive = true 
) const [inline, virtual]

This functions returns the mimimum valid at a certain eveny.

Definition at line 312 of file timeline.h.

template<class type>
virtual double frepple::utils::TimeLine< type >::getMax ( Date  d,
bool  inclusive = true 
) const [inline, virtual]

This functions returns the maximum valid at a certain date.

Definition at line 301 of file timeline.h.

template<class type>
virtual EventMaxQuantity* frepple::utils::TimeLine< type >::getMaxEvent ( Date  d,
bool  inclusive = true 
) const [inline, virtual]

This functions returns the maximum event valid at a certain date.

Definition at line 335 of file timeline.h.

template<class type>
virtual double frepple::utils::TimeLine< type >::getMin ( const Event e,
bool  inclusive = true 
) const [inline, virtual]

This functions returns the mimimum valid at a certain event.

Definition at line 289 of file timeline.h.

template<class type>
virtual double frepple::utils::TimeLine< type >::getMin ( Date  d,
bool  inclusive = true 
) const [inline, virtual]

This functions returns the mimimum valid at a certain date.

Definition at line 278 of file timeline.h.

template<class type>
virtual EventMinQuantity* frepple::utils::TimeLine< type >::getMinEvent ( Date  d,
bool  inclusive = true 
) const [inline, virtual]

This functions returns the mimimum event valid at a certain date.

Definition at line 324 of file timeline.h.

template<class type>
void frepple::utils::TimeLine< type >::insert ( EventChangeOnhand e,
double  qty,
const Date d 
) [inline]

Definition at line 255 of file timeline.h.

template<class type >
void frepple::utils::TimeLine< type >::insert ( Event e  )  [inline]

Definition at line 363 of file timeline.h.

template<class type>
void frepple::utils::TimeLine< type >::inspect ( const string &  name  )  const [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 268 of file timeline.h.

template<class type>
const_iterator frepple::utils::TimeLine< type >::rbegin (  )  const [inline]

Definition at line 251 of file timeline.h.

template<class type>
iterator frepple::utils::TimeLine< type >::rbegin (  )  [inline]

Definition at line 247 of file timeline.h.

template<class type>
int frepple::utils::TimeLine< type >::size (  )  const [inline]

Definition at line 239 of file timeline.h.

template<class type >
void frepple::utils::TimeLine< type >::update ( EventChangeOnhand e,
double  newqty,
const Date d 
) [inline]

Definition at line 491 of file timeline.h.


Friends And Related Function Documentation

template<class type>
friend class Event [friend]

Definition at line 56 of file timeline.h.


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

Documentation generated for frePPLe by  doxygen