Public Member Functions | |
| void | AddEvent (Time time, boost::shared_ptr< Event > event) |
| Schedules an event to the queue. | |
| EventQueue (RandomNumberGenerator &rng) | |
| Constructor. | |
| TimedEvent | GetNextEvent (void) |
| Returns the event scheduled to happen next. | |
| bool | RemoveEvent (boost::shared_ptr< Event const > event) |
| Removes an event from the queue. | |
| bool | RemoveEvent (Time time, boost::shared_ptr< Event const > event) |
| Removes an event from the queue. | |
| ~EventQueue (void) | |
| Destructor. | |
| YansCoreNS::EventQueue::EventQueue | ( | RandomNumberGenerator & | rng | ) | [explicit] |
Constructor.
| [in,out] | rng | A random number generator instance. |
| YansCoreNS::EventQueue::~EventQueue | ( | void | ) |
Destructor.
Schedules an event to the queue.
| [in] | time | The time the event is scheduled to happen. |
| [in,out] | event | The event to be scheduled. |
| TimedEvent YansCoreNS::EventQueue::GetNextEvent | ( | void | ) |
Returns the event scheduled to happen next.
| runtime_error | If the queue is empty. NOTE that this should not happen: the simulation should end at the occurrance of a simulationEndEvent. The exception thrown indicates that no such event was scheduled, therefore the simulation would run until infinity. |
The complexity of this method is O(log(n)) in the number of events currently in the queue.
| bool YansCoreNS::EventQueue::RemoveEvent | ( | boost::shared_ptr< Event const > | event | ) |
Removes an event from the queue.
| [in] | event | The event to be removed. |
true if the event was successfully removed from the queue; false otherwise.false. If the time the event was scheduled is known, it is more efficient to call the two-parameter version of this function.
The complexity of the method is O(n) in the number of events currently in the queue.
Removes an event from the queue.
| [in] | time | The time the event is scheduled to happen. |
| [in] | event | The event to be removed. |
true if the event was successfully removed from the queue; false otherwise.false. The complexity of this method is O(n) in the number of events scheduled at time.
1.5.8