Class holding event structures. More...
#include <stdair/bom/EventQueue.hpp>
Public Types | |
typedef EventQueueKey | Key_T |
typedef std::map < EventType::EN_EventType, ProgressStatus > | ProgressStatusMap_T |
Public Member Functions | |
const Key_T & | getKey () const |
BomAbstract *const | getParent () const |
const HolderMap_T & | getHolderMap () const |
const ProgressStatus & | getStatus () const |
const Count_T & | getCurrentNbOfEvents () const |
const Count_T & | getExpectedTotalNbOfEvents () const |
const Count_T & | getActualTotalNbOfEvents () const |
ProgressStatus | getStatus (const EventType::EN_EventType &) const |
const Count_T & | getCurrentNbOfEvents (const EventType::EN_EventType &) const |
const Count_T & | getExpectedTotalNbOfEvents (const EventType::EN_EventType &) const |
const Count_T & | getActualTotalNbOfEvents (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 |
Class holding event structures.
Event types may be:
The event content would be, respectively:
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:
Definition at line 59 of file EventQueue.hpp.
Definition allowing to retrieve the associated BOM key type.
Definition at line 68 of file EventQueue.hpp.
typedef std::map<EventType::EN_EventType, ProgressStatus> stdair::EventQueue::ProgressStatusMap_T |
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.
|
protected |
Constructor.
Definition at line 23 of file EventQueue.cpp.
|
protected |
Default copy constructor.
Definition at line 30 of file EventQueue.cpp.
|
protected |
|
inline |
|
inline |
|
inline |
Get the map of children holders.
Definition at line 92 of file EventQueue.hpp.
References _holderMap.
|
inline |
Get the overall progress status (for the whole event queue).
Definition at line 97 of file EventQueue.hpp.
References _progressStatus.
Referenced by popEvent().
|
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().
|
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().
|
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, display(), stdair::ProgressStatus::getCurrentNb(), and STDAIR_LOG_ERROR.
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::ProgressStatus::getExpectedNb(), and STDAIR_LOG_ERROR.
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, display(), stdair::ProgressStatus::getActualNb(), and STDAIR_LOG_ERROR.
|
inline |
Set/update the progress status.
Definition at line 131 of file EventQueue.hpp.
References _progressStatus.
Referenced by popEvent().
|
inline |
Set/update the progress status.
Definition at line 135 of file EventQueue.hpp.
References _progressStatus, stdair::ProgressStatus::setActualNb(), stdair::ProgressStatus::setCurrentNb(), and stdair::ProgressStatus::setExpectedNb().
|
inline |
Set/update the progress status.
Definition at line 143 of file EventQueue.hpp.
References _progressStatus, stdair::ProgressStatus::setActualNb(), and stdair::ProgressStatus::setCurrentNb().
|
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().
|
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().
|
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.
|
inlinevirtual |
Dump a Business Object into an output stream.
ostream& | the output stream. |
Implements stdair::BomAbstract.
Definition at line 176 of file EventQueue.hpp.
References toString().
|
inlinevirtual |
Read a Business Object from an input stream.
istream& | the input stream. |
Implements stdair::BomAbstract.
Definition at line 185 of file EventQueue.hpp.
|
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::getActualNb(), stdair::ProgressStatus::getCurrentNb(), and stdair::ProgressStatus::getExpectedNb().
Referenced by display(), toStream(), and updateStatus().
|
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 |
Definition at line 53 of file EventQueue.cpp.
References toString().
Referenced by calculateProgress(), getActualTotalNbOfEvents(), getCurrentNbOfEvents(), and getExpectedTotalNbOfEvents().
void stdair::EventQueue::reset | ( | ) |
Reset the event queue.
The event queue is fully emptied.
Definition at line 78 of file EventQueue.cpp.
References _eventList, _progressStatus, _progressStatusMap, and stdair::ProgressStatus::reset().
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.
Definition at line 291 of file EventQueue.cpp.
References _eventList, _progressStatus, stdair::EventStruct::getEventType(), getStatus(), stdair::ProgressStatusSet::setOverallStatus(), setStatus(), and stdair::ProgressStatusSet::setTypeSpecificStatus().
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:
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 _eventList, and isQueueEmpty().
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:
Definition at line 197 of file EventQueue.cpp.
References _progressStatus, stdair::ProgressStatus::getActualNb(), stdair::ProgressStatus::getExpectedNb(), stdair::ProgressStatus::setActualNb(), stdair::ProgressStatus::setExpectedNb(), and updateStatus().
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::ProgressStatus::getActualNb(), stdair::ProgressStatus::getCurrentNb(), stdair::ProgressStatus::getExpectedNb(), stdair::EventType::getLabel(), stdair::ProgressStatus::setActualNb(), stdair::ProgressStatus::setCurrentNb(), stdair::ProgressStatus::setExpectedNb(), STDAIR_LOG_ERROR, and toString().
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:
Definition at line 221 of file EventQueue.cpp.
References _progressStatusMap, stdair::ProgressStatus::getActualNb(), and stdair::ProgressStatus::setActualNb().
|
inline |
Calculate the progress status.
The progress is status is the ratio of:
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:
Definition at line 273 of file EventQueue.cpp.
References _progressStatusMap, display(), stdair::ProgressStatus::progress(), and STDAIR_LOG_ERROR.
Count_T stdair::EventQueue::getQueueSize | ( | ) | const |
bool stdair::EventQueue::isQueueEmpty | ( | ) | const |
Is queue empty
Definition at line 67 of file EventQueue.cpp.
References _eventList.
Referenced by isQueueDone().
|
friend |
Definition at line 60 of file EventQueue.hpp.
|
friend |
Definition at line 61 of file EventQueue.hpp.
|
protected |
Primary key (ID).
Definition at line 360 of file EventQueue.hpp.
Referenced by describeKey(), and getKey().
|
protected |
Pointer on the parent class (BomRoot).
Definition at line 365 of file EventQueue.hpp.
Referenced by getParent().
|
protected |
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().
|
protected |
List of events.
Definition at line 377 of file EventQueue.hpp.
Referenced by addEvent(), getQueueSize(), isQueueDone(), isQueueEmpty(), popEvent(), reset(), toString(), and ~EventQueue().
|
protected |
Counters holding the overall progress status.
Definition at line 382 of file EventQueue.hpp.
Referenced by addStatus(), calculateProgress(), getActualTotalNbOfEvents(), getCurrentNbOfEvents(), getExpectedTotalNbOfEvents(), getStatus(), popEvent(), reset(), setActualTotalNbOfEvents(), setCurrentNbOfEvents(), setExpectedTotalNbOfEvents(), setStatus(), and toString().
|
protected |
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 calculateProgress(), getActualTotalNbOfEvents(), getCurrentNbOfEvents(), getExpectedTotalNbOfEvents(), getStatus(), reset(), setStatus(), and updateStatus().