StdAir Logo  0.45.0
C++ Standard Airline IT Object Library
stdair::EventQueue Class Reference

Class holding event structures. More...

#include <stdair/bom/EventQueue.hpp>

+ Inheritance diagram for stdair::EventQueue:

List of all members.

Public Types

typedef EventQueueKey Key_T
typedef std::map
< EventType::EN_EventType,
ProgressStatus
ProgressStatusMap_T

Public Member Functions

const Key_TgetKey () const
BomAbstract *const getParent () const
const HolderMap_TgetHolderMap () const
const ProgressStatusgetStatus () const
const Count_TgetCurrentNbOfEvents () const
const Count_TgetExpectedTotalNbOfEvents () const
const Count_TgetActualTotalNbOfEvents () const
ProgressStatus getStatus (const EventType::EN_EventType &) const
const Count_TgetCurrentNbOfEvents (const EventType::EN_EventType &) const
const Count_TgetExpectedTotalNbOfEvents (const EventType::EN_EventType &) const
const Count_TgetActualTotalNbOfEvents (const EventType::EN_EventType &) const
void setStatus (const ProgressStatus &iProgressStatus)
void setStatus (const Count_T &iCurrentNbOfEvents, const Count_T &iExpectedTotalNbOfEvents, const Count_T &iActualTotalNbOfEvents)
void setStatus (const Count_T &iCurrentNbOfEvents, const Count_T &iActualTotalNbOfEvents)
void setCurrentNbOfEvents (const Count_T &iCurrentNbOfEvents)
void setExpectedTotalNbOfEvents (const Count_T &iExpectedTotalNbOfEvents)
void setActualTotalNbOfEvents (const Count_T &iActualTotalNbOfEvents)
void setStatus (const EventType::EN_EventType &iType, const ProgressStatus &iProgressStatus)
void toStream (std::ostream &ioOut) const
void fromStream (std::istream &ioIn)
std::string toString () const
const std::string describeKey () const
std::string display () const
void reset ()
ProgressStatusSet popEvent (EventStruct &)
bool addEvent (EventStruct &)
bool isQueueDone () const
void addStatus (const EventType::EN_EventType &, const NbOfRequests_T &iExpectedTotalNbOfEvents)
void updateStatus (const EventType::EN_EventType &, const ProgressStatus &iProgressStatus)
void updateStatus (const EventType::EN_EventType &, const NbOfEvents_T &iActualTotalNbOfEvents)
ProgressPercentage_T calculateProgress () const
ProgressPercentage_T calculateProgress (const EventType::EN_EventType &) const
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
HolderMap_T _holderMap
EventList_T _eventList
ProgressStatus _progressStatus
ProgressStatusMap_T _progressStatusMap

Friends

class FacBom
class 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}

Member Typedef Documentation

Definition allowing to retrieve the associated BOM key type.

Definition at line 68 of file EventQueue.hpp.

Definition of the (STL) map of ProgressStatus structures, one for each event type (e.g., booking request, optimisation notification).

Definition at line 76 of file EventQueue.hpp.


Constructor & Destructor Documentation

stdair::EventQueue::EventQueue ( const Key_T iKey) [protected]

Constructor.

Definition at line 23 of file EventQueue.cpp.

stdair::EventQueue::EventQueue ( const EventQueue iEventQueue) [protected]

Default copy constructor.

Definition at line 30 of file EventQueue.cpp.

stdair::EventQueue::~EventQueue ( ) [protected]

Destructor.

Definition at line 38 of file EventQueue.cpp.

References _eventList.


Member Function Documentation

const Key_T& stdair::EventQueue::getKey ( ) const [inline]

Get the event queue key.

Definition at line 82 of file EventQueue.hpp.

References _key.

BomAbstract* const stdair::EventQueue::getParent ( ) const [inline]

Get the parent object.

Definition at line 87 of file EventQueue.hpp.

References _parent.

const HolderMap_T& stdair::EventQueue::getHolderMap ( ) const [inline]

Get the map of children holders.

Definition at line 92 of file EventQueue.hpp.

References _holderMap.

const ProgressStatus& stdair::EventQueue::getStatus ( ) const [inline]

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

Definition at line 97 of file EventQueue.hpp.

References _progressStatus.

Referenced by popEvent().

const Count_T& stdair::EventQueue::getCurrentNbOfEvents ( ) const [inline]

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

Definition at line 101 of file EventQueue.hpp.

References _progressStatus, and stdair::ProgressStatus::getCurrentNb().

const Count_T& stdair::EventQueue::getExpectedTotalNbOfEvents ( ) const [inline]

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

Definition at line 105 of file EventQueue.hpp.

References _progressStatus, and stdair::ProgressStatus::getExpectedNb().

Referenced by stdair::STDAIR_Service::getExpectedTotalNumberOfEventsToBeGenerated().

const Count_T& stdair::EventQueue::getActualTotalNbOfEvents ( ) const [inline]

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

Definition at line 109 of file EventQueue.hpp.

References _progressStatus, and stdair::ProgressStatus::getActualNb().

Referenced by stdair::STDAIR_Service::getActualTotalNumberOfEventsToBeGenerated().

ProgressStatus stdair::EventQueue::getStatus ( const 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 257 of file EventQueue.cpp.

References _progressStatusMap.

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

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

Definition at line 97 of file EventQueue.cpp.

References _progressStatusMap, STDAIR_LOG_ERROR, display(), and stdair::ProgressStatus::getCurrentNb().

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

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

Definition at line 116 of file EventQueue.cpp.

References _progressStatusMap, display(), STDAIR_LOG_ERROR, and stdair::ProgressStatus::getExpectedNb().

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

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

Definition at line 138 of file EventQueue.cpp.

References _progressStatusMap, STDAIR_LOG_ERROR, display(), and stdair::ProgressStatus::getActualNb().

void stdair::EventQueue::setStatus ( const ProgressStatus iProgressStatus) [inline]

Set/update the progress status.

Definition at line 131 of file EventQueue.hpp.

References _progressStatus.

Referenced by popEvent().

void stdair::EventQueue::setStatus ( const Count_T iCurrentNbOfEvents,
const Count_T iExpectedTotalNbOfEvents,
const Count_T iActualTotalNbOfEvents 
) [inline]
void stdair::EventQueue::setStatus ( const Count_T iCurrentNbOfEvents,
const Count_T iActualTotalNbOfEvents 
) [inline]

Set/update the progress status.

Definition at line 143 of file EventQueue.hpp.

References _progressStatus, stdair::ProgressStatus::setCurrentNb(), and stdair::ProgressStatus::setActualNb().

void stdair::EventQueue::setCurrentNbOfEvents ( const Count_T iCurrentNbOfEvents) [inline]

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

Definition at line 149 of file EventQueue.hpp.

References _progressStatus, and stdair::ProgressStatus::setCurrentNb().

void stdair::EventQueue::setExpectedTotalNbOfEvents ( const Count_T iExpectedTotalNbOfEvents) [inline]

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

Definition at line 153 of file EventQueue.hpp.

References _progressStatus, and stdair::ProgressStatus::setExpectedNb().

void stdair::EventQueue::setActualTotalNbOfEvents ( const Count_T iActualTotalNbOfEvents) [inline]

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

Definition at line 157 of file EventQueue.hpp.

References _progressStatus, and stdair::ProgressStatus::setActualNb().

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

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

Definition at line 241 of file EventQueue.cpp.

References _progressStatusMap.

void stdair::EventQueue::toStream ( std::ostream ioOut) const [inline, virtual]

Dump a Business Object into an output stream.

Parameters:
ostream&the output stream.

Implements stdair::BomAbstract.

Definition at line 176 of file EventQueue.hpp.

References toString().

void stdair::EventQueue::fromStream ( std::istream ioIn) [inline, virtual]

Read a Business Object from an input stream.

Parameters:
istream&the input stream.

Implements stdair::BomAbstract.

Definition at line 185 of file EventQueue.hpp.

std::string stdair::EventQueue::toString ( ) const [virtual]

Get the serialised version of the Business Object.

Implements stdair::BomAbstract.

Definition at line 43 of file EventQueue.cpp.

References _eventList, _progressStatus, stdair::ProgressStatus::getCurrentNb(), stdair::ProgressStatus::getExpectedNb(), and stdair::ProgressStatus::getActualNb().

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

const std::string stdair::EventQueue::describeKey ( ) const [inline]

Get a string describing the key.

Definition at line 196 of file EventQueue.hpp.

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

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

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

Definition at line 78 of file EventQueue.cpp.

References _progressStatus, stdair::ProgressStatus::reset(), _eventList, and _progressStatusMap.

Referenced by stdair::STDAIR_Service::reset().

ProgressStatusSet stdair::EventQueue::popEvent ( 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 291 of file EventQueue.cpp.

References _eventList, stdair::EventStruct::getEventType(), _progressStatus, getStatus(), setStatus(), stdair::ProgressStatusSet::setTypeSpecificStatus(), and stdair::ProgressStatusSet::setOverallStatus().

Referenced by stdair::STDAIR_Service::popEvent().

bool stdair::EventQueue::addEvent ( 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 351 of file EventQueue.cpp.

References _eventList.

bool stdair::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 72 of file EventQueue.cpp.

References isQueueEmpty(), and _eventList.

Referenced by stdair::STDAIR_Service::isQueueDone().

void stdair::EventQueue::addStatus ( const EventType::EN_EventType iType,
const 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 197 of file EventQueue.cpp.

References updateStatus(), _progressStatus, stdair::ProgressStatus::getExpectedNb(), stdair::ProgressStatus::setExpectedNb(), stdair::ProgressStatus::getActualNb(), and stdair::ProgressStatus::setActualNb().

void stdair::EventQueue::updateStatus ( const EventType::EN_EventType iType,
const 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 156 of file EventQueue.cpp.

References _progressStatusMap, STDAIR_LOG_ERROR, stdair::EventType::getLabel(), toString(), stdair::ProgressStatus::getCurrentNb(), stdair::ProgressStatus::setCurrentNb(), stdair::ProgressStatus::getExpectedNb(), stdair::ProgressStatus::setExpectedNb(), stdair::ProgressStatus::getActualNb(), and stdair::ProgressStatus::setActualNb().

Referenced by addStatus().

void stdair::EventQueue::updateStatus ( const EventType::EN_EventType iType,
const 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 221 of file EventQueue.cpp.

References _progressStatusMap, stdair::ProgressStatus::getActualNb(), and stdair::ProgressStatus::setActualNb().

ProgressPercentage_T stdair::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 316 of file EventQueue.hpp.

References _progressStatus, and stdair::ProgressStatus::progress().

ProgressPercentage_T stdair::EventQueue::calculateProgress ( const 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 273 of file EventQueue.cpp.

References _progressStatusMap, STDAIR_LOG_ERROR, display(), and stdair::ProgressStatus::progress().

Count_T stdair::EventQueue::getQueueSize ( ) const

Queue size

Definition at line 62 of file EventQueue.cpp.

References _eventList.

bool stdair::EventQueue::isQueueEmpty ( ) const

Is queue empty

Definition at line 67 of file EventQueue.cpp.

References _eventList.

Referenced by isQueueDone().


Friends And Related Function Documentation

friend class FacBom [friend]

Definition at line 60 of file EventQueue.hpp.

friend class FacBomManager [friend]

Definition at line 61 of file EventQueue.hpp.


Member Data Documentation

Primary key (ID).

Definition at line 360 of file EventQueue.hpp.

Referenced by getKey(), and describeKey().

Pointer on the parent class (BomRoot).

Definition at line 365 of file EventQueue.hpp.

Referenced by getParent().

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

Definition at line 372 of file EventQueue.hpp.

Referenced by getHolderMap().

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

Definition at line 389 of file EventQueue.hpp.

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


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