SEvMgr Logo  1.00.0
C++ Simulation-Oriented Discrete Event Management Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
SEVMGR::EventQueue Class Reference

Class holding event structures. More...

#include <sevmgr/bom/EventQueue.hpp>

+ Inheritance diagram for SEVMGR::EventQueue:

List of all members.

Public Types

typedef EventQueueKey Key_T

Public Member Functions

const Key_TgetKey () const
BomAbstract *const getParent () const
const stdair::EventList_T & getEventList () const
const stdair::HolderMap_T & getHolderMap () const
const stdair::ProgressStatus & getStatus () const
const stdair::Count_T & getCurrentNbOfEvents () const
const stdair::Count_T & getExpectedTotalNbOfEvents () const
const stdair::Count_T & getActualTotalNbOfEvents () const
const stdair::ProgressStatus & getStatus (const stdair::EventType::EN_EventType &) const
const stdair::Count_T & getCurrentNbOfEvents (const stdair::EventType::EN_EventType &) const
const stdair::Count_T & getExpectedTotalNbOfEvents (const stdair::EventType::EN_EventType &) const
const stdair::Count_T & getActualTotalNbOfEvents (const stdair::EventType::EN_EventType &) const
bool hasProgressStatus (const stdair::EventType::EN_EventType &) const
void setStatus (const stdair::ProgressStatus &iProgressStatus)
void setStatus (const stdair::Count_T &iCurrentNbOfEvents, const stdair::Count_T &iExpectedTotalNbOfEvents, const stdair::Count_T &iActualTotalNbOfEvents)
void setStatus (const stdair::Count_T &iCurrentNbOfEvents, const stdair::Count_T &iActualTotalNbOfEvents)
void setCurrentNbOfEvents (const stdair::Count_T &iCurrentNbOfEvents)
void setExpectedTotalNbOfEvents (const stdair::Count_T &iExpectedTotalNbOfEvents)
void setStatus (const stdair::EventType::EN_EventType &iType, const stdair::ProgressStatus &iProgressStatus)
void toStream (std::ostream &ioOut) const
void fromStream (std::istream &ioIn)
std::string toString () const
std::string list () const
std::string list (const stdair::EventType::EN_EventType &) const
const std::string describeKey () const
std::string display () const
void reset ()
stdair::ProgressStatusSet popEvent (stdair::EventStruct &)
bool addEvent (stdair::EventStruct &)
bool hasEventDateTime (const stdair::DateTime_T &)
bool isQueueDone () const
void addStatus (const stdair::EventType::EN_EventType &, const stdair::NbOfRequests_T &iExpectedTotalNbOfEvents)
void updateStatus (const stdair::EventType::EN_EventType &, const stdair::ProgressStatus &iProgressStatus)
void updateStatus (const stdair::EventType::EN_EventType &, const stdair::NbOfEvents_T &iActualTotalNbOfEvents)
stdair::ProgressPercentage_T calculateProgress () const
stdair::ProgressPercentage_T calculateProgress (const stdair::EventType::EN_EventType &) const
stdair::Count_T getQueueSize () const
bool isQueueEmpty () const

Protected Member Functions

 EventQueue (const Key_T &)
 EventQueue (const EventQueue &)
 ~EventQueue ()

Protected Attributes

Key_T _key
BomAbstract_parent
stdair::HolderMap_T _holderMap
stdair::EventList_T _eventList
stdair::ProgressStatus _progressStatus
ProgressStatusMap_T _progressStatusMap

Friends

class stdair::FacBom
class stdair::FacBomManager

Detailed Description

Class holding event structures.

Event types may be:

  • booking requests,
  • optimisation notifications,
  • (simulation) break point,
  • schedule changes.

The event content would be, respectively:

  • a demand stream (generating booking requests),
  • a DCP rule (generation optimisation notifications),
  • a break point rule (generating simulation break points),
  • a schedule update (generating schedule changes).

The EventQueue object keeps track of the simulation progress, overall and broken down (independently) both by event type and by content key. Following is a full example:

  • Break down by event type:
    • Booking request: 9 events out of {expected: 20, actual: 20}
    • Optimisation notification: 7 events out of {expected: 32, actual: 32}
  • Break down by content key:
    • "SIN-BKK" demand stream: 5 events out of {expected: 10, actual: 11}
    • "SIN-NRT" demand stream: 4 events out of {expected: 10, actual: 9}
    • "SQ 12" DCP rule: 2 events out of {expected: 16, actual: 16}
    • "SQ 25" DCP rule: 5 events out of {expected: 16, actual: 16}
  • Overall status: 16 events out of {expected: 52, actual: 52}

Definition at line 68 of file EventQueue.hpp.


Member Typedef Documentation

Definition allowing to retrieve the associated BOM key type.

Definition at line 77 of file EventQueue.hpp.


Constructor & Destructor Documentation

SEVMGR::EventQueue::EventQueue ( const Key_T iKey)
protected

Constructor.

Definition at line 25 of file EventQueue.cpp.

SEVMGR::EventQueue::EventQueue ( const EventQueue iEventQueue)
protected

Default copy constructor.

Definition at line 32 of file EventQueue.cpp.

SEVMGR::EventQueue::~EventQueue ( )
protected

Destructor.

Definition at line 40 of file EventQueue.cpp.

References _eventList.


Member Function Documentation

const Key_T& SEVMGR::EventQueue::getKey ( ) const
inline

Get the event queue key.

Definition at line 83 of file EventQueue.hpp.

References _key.

BomAbstract* const SEVMGR::EventQueue::getParent ( ) const
inline

Get the parent object.

Definition at line 88 of file EventQueue.hpp.

References _parent.

const stdair::EventList_T& SEVMGR::EventQueue::getEventList ( ) const
inline

Get the list of events.

Definition at line 93 of file EventQueue.hpp.

References _eventList.

Referenced by SEVMGR::BomJSONExport::jsonExportEventQueue().

const stdair::HolderMap_T& SEVMGR::EventQueue::getHolderMap ( ) const
inline

Get the map of children holders.

Definition at line 98 of file EventQueue.hpp.

References _holderMap.

const stdair::ProgressStatus& SEVMGR::EventQueue::getStatus ( ) const
inline

Get the overall progress status (for the whole event queue).

Definition at line 103 of file EventQueue.hpp.

References _progressStatus.

Referenced by popEvent().

const stdair::Count_T& SEVMGR::EventQueue::getCurrentNbOfEvents ( ) const
inline

Get the current number of events (for the whole event queue).

Definition at line 107 of file EventQueue.hpp.

References _progressStatus.

const stdair::Count_T& SEVMGR::EventQueue::getExpectedTotalNbOfEvents ( ) const
inline

Get the expected total number of events (for the whole event queue).

Definition at line 111 of file EventQueue.hpp.

References _progressStatus.

const stdair::Count_T& SEVMGR::EventQueue::getActualTotalNbOfEvents ( ) const
inline

Get the actual total number of events (for the whole event queue).

Definition at line 115 of file EventQueue.hpp.

References _progressStatus.

const stdair::ProgressStatus & SEVMGR::EventQueue::getStatus ( const stdair::EventType::EN_EventType &  iType) const

Get the progress status for the given event type (e.g., booking request, optimisation notification, schedule change, break point).

Definition at line 324 of file EventQueue.cpp.

References _progressStatusMap, and display().

const stdair::Count_T & SEVMGR::EventQueue::getCurrentNbOfEvents ( const stdair::EventType::EN_EventType &  iType) const

Get the current number of events for the given event type.

Definition at line 157 of file EventQueue.cpp.

References _progressStatusMap, and display().

const stdair::Count_T & SEVMGR::EventQueue::getExpectedTotalNbOfEvents ( const stdair::EventType::EN_EventType &  iType) const

Get the expected total number of events for the given event type.

Definition at line 176 of file EventQueue.cpp.

References _progressStatusMap, and display().

const stdair::Count_T & SEVMGR::EventQueue::getActualTotalNbOfEvents ( const stdair::EventType::EN_EventType &  iType) const

Get the actual total number of events for the given event type.

Definition at line 198 of file EventQueue.cpp.

References _progressStatusMap, and display().

bool SEVMGR::EventQueue::hasProgressStatus ( const stdair::EventType::EN_EventType &  iType) const

Check if the event queue has already a progress status for the given event type

Definition at line 136 of file EventQueue.cpp.

References _progressStatusMap, and display().

void SEVMGR::EventQueue::setStatus ( const stdair::ProgressStatus &  iProgressStatus)
inline

Set/update the progress status.

Definition at line 141 of file EventQueue.hpp.

References _progressStatus.

Referenced by popEvent().

void SEVMGR::EventQueue::setStatus ( const stdair::Count_T &  iCurrentNbOfEvents,
const stdair::Count_T &  iExpectedTotalNbOfEvents,
const stdair::Count_T &  iActualTotalNbOfEvents 
)
inline

Set/update the progress status.

Definition at line 145 of file EventQueue.hpp.

References _progressStatus.

void SEVMGR::EventQueue::setStatus ( const stdair::Count_T &  iCurrentNbOfEvents,
const stdair::Count_T &  iActualTotalNbOfEvents 
)
inline

Set/update the progress status.

Definition at line 153 of file EventQueue.hpp.

References _progressStatus.

void SEVMGR::EventQueue::setCurrentNbOfEvents ( const stdair::Count_T &  iCurrentNbOfEvents)
inline

Set the current number of events (for the whole event queue).

Definition at line 159 of file EventQueue.hpp.

References _progressStatus.

void SEVMGR::EventQueue::setExpectedTotalNbOfEvents ( const stdair::Count_T &  iExpectedTotalNbOfEvents)
inline

Set the expected total number of events (for the whole event queue).

Definition at line 163 of file EventQueue.hpp.

References _progressStatus.

void SEVMGR::EventQueue::setStatus ( const stdair::EventType::EN_EventType &  iType,
const stdair::ProgressStatus &  iProgressStatus 
)

Set the progress status for the given event type (e.g., booking request, optimisation notification, schedule change, break point).

Definition at line 308 of file EventQueue.cpp.

References _progressStatusMap.

void SEVMGR::EventQueue::toStream ( std::ostream &  ioOut) const
inline

Dump a Business Object into an output stream.

Parameters:
ostream&the output stream.

Definition at line 182 of file EventQueue.hpp.

References toString().

void SEVMGR::EventQueue::fromStream ( std::istream &  ioIn)
inline

Read a Business Object from an input stream.

Parameters:
istream&the input stream.

Definition at line 191 of file EventQueue.hpp.

std::string SEVMGR::EventQueue::toString ( ) const

Get the serialised version of the Business Object.

Definition at line 45 of file EventQueue.cpp.

References _eventList, and _progressStatus.

Referenced by display(), list(), toStream(), and updateStatus().

std::string SEVMGR::EventQueue::list ( ) const

Get the event list decsription.

Definition at line 64 of file EventQueue.cpp.

References _eventList, describeKey(), and toString().

std::string SEVMGR::EventQueue::list ( const stdair::EventType::EN_EventType &  iType) const

Get the event list decsription for a given event type

Definition at line 82 of file EventQueue.cpp.

References _eventList, describeKey(), and toString().

const std::string SEVMGR::EventQueue::describeKey ( ) const
inline

Get a string describing the key.

Definition at line 213 of file EventQueue.hpp.

References _key, and SEVMGR::EventQueueKey::toString().

Referenced by list(), and popEvent().

std::string SEVMGR::EventQueue::display ( ) const
void SEVMGR::EventQueue::reset ( )

Reset the event queue.
The event queue is fully emptied.

Definition at line 118 of file EventQueue.cpp.

References _eventList, _progressStatus, and _progressStatusMap.

stdair::ProgressStatusSet SEVMGR::EventQueue::popEvent ( stdair::EventStruct &  ioEventStruct)

Pop the next coming (in time) event, and remove it from the event queue.

  • The next coming (in time) event corresponds to the event having the earliest date-time stamp. In other words, it is the first/front element of the event queue.
  • That (first) event/element is then removed from the event queue
  • The progress status is updated for the corresponding event generator.

Definition at line 365 of file EventQueue.cpp.

References _eventList, _progressStatus, describeKey(), getStatus(), and setStatus().

bool SEVMGR::EventQueue::addEvent ( stdair::EventStruct &  ioEventStruct)

Add event.

If there already is an event with the same date-time, move the given event one nanosecond forward, and retry the insertion until it succeeds.

That method:

  • first adds the event structure in the dedicated list,
  • then retrieves the corresponding demand stream,
  • and update accordingly the corresponding progress statuses.
Parameters:
stdair::EventStruct&The reference on EventStruct is not constant, because the EventStruct object can be altered: its date-time stamp can be changed accordingly to the location where it has been inserted in the event queue.

Definition at line 433 of file EventQueue.cpp.

References _eventList.

bool SEVMGR::EventQueue::hasEventDateTime ( const stdair::DateTime_T &  iDateTime)

Find the event with the given date time, if such event existed.

Definition at line 466 of file EventQueue.cpp.

References _eventList.

bool SEVMGR::EventQueue::isQueueDone ( ) const

States whether the event queue has reached the end.

For now, that method states whether the event queue is empty.

Definition at line 112 of file EventQueue.cpp.

References _eventList, and isQueueEmpty().

void SEVMGR::EventQueue::addStatus ( const stdair::EventType::EN_EventType &  ,
const stdair::NbOfRequests_T &  iExpectedTotalNbOfEvents 
)

Initialise the progress statuses for the given event type (e.g., request, snapshot).

The progress status is actually a pair of counters:

  • The current number of (already generated) events, for the given event type. That number is initialised to 0 (no event has been generated yet).
  • The total number of events (to be generated), also for the given event type.

Definition at line 257 of file EventQueue.cpp.

References _progressStatus, and updateStatus().

void SEVMGR::EventQueue::updateStatus ( const stdair::EventType::EN_EventType &  iType,
const stdair::ProgressStatus &  iProgressStatus 
)

Set/update the progress status for the corresponding event type (e.g., booking request, optimisation notification, schedule change, break point).

If there is no ProgressStatus object for that event type yet, one is inserted. Otherwise, the ProgressStatus object is updated.

Definition at line 216 of file EventQueue.cpp.

References _progressStatusMap, and toString().

Referenced by addStatus().

void SEVMGR::EventQueue::updateStatus ( const stdair::EventType::EN_EventType &  iType,
const stdair::NbOfEvents_T &  iActualTotalNbOfEvents 
)

Update the progress statuses for the given event type (e.g., booking request, optimisation notification, schedule change, break point).

The progress status is actually a pair of counters:

  • The current number of (already generated) events, for the given event type. That number is initialised to 0 (no event has been generated yet).
  • The total number of events (to be generated), also for the given event type.

Definition at line 282 of file EventQueue.cpp.

References _progressStatus, and _progressStatusMap.

stdair::ProgressPercentage_T SEVMGR::EventQueue::calculateProgress ( ) const
inline

Calculate the progress status.
The progress is status is the ratio of:

  • the current number of events, summed over all the demand streams,
  • over the total number of events, also summed over all the demand streams.

Definition at line 338 of file EventQueue.hpp.

References _progressStatus.

stdair::ProgressPercentage_T SEVMGR::EventQueue::calculateProgress ( const stdair::EventType::EN_EventType &  iType) const

Calculate the progress status.
The progress is status is the ratio of:

  • the current number of events, summed over all the demand streams,
  • over the total number of events, also summed over all the demand streams.

Definition at line 347 of file EventQueue.cpp.

References _progressStatusMap, and display().

stdair::Count_T SEVMGR::EventQueue::getQueueSize ( ) const

Queue size

Definition at line 102 of file EventQueue.cpp.

References _eventList.

bool SEVMGR::EventQueue::isQueueEmpty ( ) const

Is queue empty

Definition at line 107 of file EventQueue.cpp.

References _eventList.

Referenced by isQueueDone().


Friends And Related Function Documentation

friend class stdair::FacBom
friend

Definition at line 69 of file EventQueue.hpp.

friend class stdair::FacBomManager
friend

Definition at line 70 of file EventQueue.hpp.


Member Data Documentation

Key_T SEVMGR::EventQueue::_key
protected

Primary key (ID).

Definition at line 382 of file EventQueue.hpp.

Referenced by describeKey(), and getKey().

BomAbstract* SEVMGR::EventQueue::_parent
protected

Pointer on the parent class (BomRoot).

Definition at line 387 of file EventQueue.hpp.

Referenced by getParent().

stdair::HolderMap_T SEVMGR::EventQueue::_holderMap
protected

Map holding the children (e.g., DemandStream objects for booking requests, DCPRule objects for optimisation notifications).

Definition at line 394 of file EventQueue.hpp.

Referenced by getHolderMap().

stdair::EventList_T SEVMGR::EventQueue::_eventList
protected
stdair::ProgressStatus SEVMGR::EventQueue::_progressStatus
protected
ProgressStatusMap_T SEVMGR::EventQueue::_progressStatusMap
protected

Counters holding the overall progress status, for each event type (e.g., booking request, optimisation notification, schedule change, break point).

Definition at line 411 of file EventQueue.hpp.

Referenced by calculateProgress(), getActualTotalNbOfEvents(), getCurrentNbOfEvents(), getExpectedTotalNbOfEvents(), getStatus(), hasProgressStatus(), reset(), setStatus(), and updateStatus().


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