Class holding event structures. More...
#include <stdair/bom/EventQueue.hpp>
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 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.
stdair::EventQueue::EventQueue | ( | const Key_T & | iKey | ) | [protected] |
Constructor.
Definition at line 25 of file EventQueue.cpp.
stdair::EventQueue::EventQueue | ( | const EventQueue & | iEventQueue | ) | [protected] |
Default copy constructor.
Definition at line 32 of file EventQueue.cpp.
stdair::EventQueue::~EventQueue | ( | ) | [protected] |
const Key_T& stdair::EventQueue::getKey | ( | ) | const [inline] |
BomAbstract* const stdair::EventQueue::getParent | ( | ) | const [inline] |
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 254 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 99 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 118 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 140 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] |
Set/update the progress status.
Definition at line 135 of file EventQueue.hpp.
References _progressStatus, stdair::ProgressStatus::setCurrentNb(), stdair::ProgressStatus::setExpectedNb(), and stdair::ProgressStatus::setActualNb().
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 238 of file EventQueue.cpp.
References _progressStatusMap.
void stdair::EventQueue::toStream | ( | std::ostream & | ioOut | ) | const [inline, virtual] |
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().
void stdair::EventQueue::fromStream | ( | std::istream & | ioIn | ) | [inline, virtual] |
Read a Business Object from an input stream.
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 45 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 |
Definition at line 55 of file EventQueue.cpp.
References toString().
Referenced by getCurrentNbOfEvents(), getExpectedTotalNbOfEvents(), getActualTotalNbOfEvents(), and calculateProgress().
void stdair::EventQueue::reset | ( | ) |
Reset the event queue.
The event queue is fully emptied.
Definition at line 80 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.
Definition at line 288 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:
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 348 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 74 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:
Definition at line 199 of file EventQueue.cpp.
References updateStatus(), _progressStatus, stdair::ProgressStatus::setExpectedNb(), stdair::ProgressStatus::getExpectedNb(), stdair::ProgressStatus::setActualNb(), and stdair::ProgressStatus::getActualNb().
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 158 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:
Definition at line 219 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:
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 270 of file EventQueue.cpp.
References _progressStatusMap, STDAIR_LOG_ERROR, display(), and stdair::ProgressStatus::progress().
Count_T stdair::EventQueue::getQueueSize | ( | ) | const |
bool stdair::EventQueue::isQueueEmpty | ( | ) | const |
Is queue empty
Definition at line 69 of file EventQueue.cpp.
References _eventList.
Referenced by isQueueDone().
friend class FacBom [friend] |
Definition at line 60 of file EventQueue.hpp.
friend class FacBomManager [friend] |
Definition at line 61 of file EventQueue.hpp.
Key_T stdair::EventQueue::_key [protected] |
Primary key (ID).
Definition at line 360 of file EventQueue.hpp.
Referenced by getKey(), and describeKey().
BomAbstract* stdair::EventQueue::_parent [protected] |
Pointer on the parent class (BomRoot).
Definition at line 365 of file EventQueue.hpp.
Referenced by getParent().
HolderMap_T stdair::EventQueue::_holderMap [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().
EventList_T stdair::EventQueue::_eventList [protected] |
List of events.
Definition at line 377 of file EventQueue.hpp.
Referenced by ~EventQueue(), toString(), getQueueSize(), isQueueEmpty(), isQueueDone(), reset(), popEvent(), and addEvent().
ProgressStatus stdair::EventQueue::_progressStatus [protected] |
Counters holding the overall progress status.
Definition at line 382 of file EventQueue.hpp.
Referenced by toString(), reset(), addStatus(), popEvent(), getStatus(), getCurrentNbOfEvents(), getExpectedTotalNbOfEvents(), getActualTotalNbOfEvents(), setStatus(), setCurrentNbOfEvents(), setExpectedTotalNbOfEvents(), setActualTotalNbOfEvents(), and calculateProgress().
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().