Class holding event structures. More...
#include <sevmgr/bom/EventQueue.hpp>
Public Types | |
typedef EventQueueKey | Key_T |
Public Member Functions | |
const Key_T & | getKey () 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 |
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 68 of file EventQueue.hpp.
Definition allowing to retrieve the associated BOM key type.
Definition at line 77 of file EventQueue.hpp.
|
protected |
Constructor.
Definition at line 25 of file EventQueue.cpp.
|
protected |
Default copy constructor.
Definition at line 32 of file EventQueue.cpp.
|
protected |
|
inline |
|
inline |
|
inline |
Get the list of events.
Definition at line 93 of file EventQueue.hpp.
References _eventList.
Referenced by SEVMGR::BomJSONExport::jsonExportEventQueue().
|
inline |
Get the map of children holders.
Definition at line 98 of file EventQueue.hpp.
References _holderMap.
|
inline |
Get the overall progress status (for the whole event queue).
Definition at line 103 of file EventQueue.hpp.
References _progressStatus.
Referenced by popEvent().
|
inline |
Get the current number of events (for the whole event queue).
Definition at line 107 of file EventQueue.hpp.
References _progressStatus.
|
inline |
Get the expected total number of events (for the whole event queue).
Definition at line 111 of file EventQueue.hpp.
References _progressStatus.
|
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().
|
inline |
Set/update the progress status.
Definition at line 141 of file EventQueue.hpp.
References _progressStatus.
Referenced by popEvent().
|
inline |
Set/update the progress status.
Definition at line 145 of file EventQueue.hpp.
References _progressStatus.
|
inline |
Set/update the progress status.
Definition at line 153 of file EventQueue.hpp.
References _progressStatus.
|
inline |
Set the current number of events (for the whole event queue).
Definition at line 159 of file EventQueue.hpp.
References _progressStatus.
|
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.
|
inline |
Dump a Business Object into an output stream.
ostream& | the output stream. |
Definition at line 182 of file EventQueue.hpp.
References toString().
|
inline |
Read a Business Object from an input stream.
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().
|
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 |
Definition at line 55 of file EventQueue.cpp.
References toString().
Referenced by calculateProgress(), getActualTotalNbOfEvents(), getCurrentNbOfEvents(), getExpectedTotalNbOfEvents(), getStatus(), and hasProgressStatus().
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.
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:
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:
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:
Definition at line 282 of file EventQueue.cpp.
References _progressStatus, and _progressStatusMap.
|
inline |
Calculate the progress status.
The progress is status is the ratio of:
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:
Definition at line 347 of file EventQueue.cpp.
References _progressStatusMap, and display().
stdair::Count_T SEVMGR::EventQueue::getQueueSize | ( | ) | const |
bool SEVMGR::EventQueue::isQueueEmpty | ( | ) | const |
Is queue empty
Definition at line 107 of file EventQueue.cpp.
References _eventList.
Referenced by isQueueDone().
|
friend |
Definition at line 69 of file EventQueue.hpp.
|
friend |
Definition at line 70 of file EventQueue.hpp.
|
protected |
Primary key (ID).
Definition at line 382 of file EventQueue.hpp.
Referenced by describeKey(), and getKey().
|
protected |
Pointer on the parent class (BomRoot).
Definition at line 387 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 394 of file EventQueue.hpp.
Referenced by getHolderMap().
|
protected |
List of events.
Definition at line 399 of file EventQueue.hpp.
Referenced by addEvent(), getEventList(), getQueueSize(), hasEventDateTime(), isQueueDone(), isQueueEmpty(), list(), popEvent(), reset(), toString(), and ~EventQueue().
|
protected |
Counters holding the overall progress status.
Definition at line 404 of file EventQueue.hpp.
Referenced by addStatus(), calculateProgress(), getActualTotalNbOfEvents(), getCurrentNbOfEvents(), getExpectedTotalNbOfEvents(), getStatus(), popEvent(), reset(), setCurrentNbOfEvents(), setExpectedTotalNbOfEvents(), setStatus(), toString(), and updateStatus().
|
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().