ns-3
|
a calendar queue event scheduler More...
#include <calendar-scheduler.h>
Public Member Functions | |
virtual void | Insert (const Event &ev) |
virtual bool | IsEmpty (void) const |
virtual Event | PeekNext (void) const |
virtual Event | RemoveNext (void) |
virtual void | Remove (const Event &ev) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::CalendarScheduler. |
a calendar queue event scheduler
This event scheduler is a direct implementation of the algorithm known as a calendar queue. first published in 1988 in "Calendar Queues: A Fast O(1) Priority Queue Implementation for the Simulation Event Set Problem" by Randy Brown. There are many refinements published later but this class implements the original algorithm (to the best of my knowledge).
Note: This queue is much slower than I expected (much slower than the std::map queue) and this seems to be because the original resizing policy is horribly bad. This is most likely the reason why there have been so many variations published which all slightly tweak the resizing heuristics to obtain a better distribution of events across buckets.
TypeId ns3::CalendarScheduler::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::CalendarScheduler.
This object is accessible through the following paths with Config::Set and Config::Connect:
No Attributes defined for this type.
No TraceSources defined for this type.
Reimplemented from ns3::Scheduler.
References ns3::TypeId::SetParent().
void ns3::CalendarScheduler::Insert | ( | const Event & | ev | ) | [virtual] |
ev | event to store in the event list |
Implements ns3::Scheduler.
bool ns3::CalendarScheduler::IsEmpty | ( | void | ) | const [virtual] |
Implements ns3::Scheduler.
Referenced by PeekNext(), Remove(), and RemoveNext().
Scheduler::Event ns3::CalendarScheduler::PeekNext | ( | void | ) | const [virtual] |
This method cannot be invoked if the list is empty.
Implements ns3::Scheduler.
References IsEmpty(), NS_ASSERT, and NS_LOG_FUNCTION.
void ns3::CalendarScheduler::Remove | ( | const Event & | ev | ) | [virtual] |
ev | the event to remove |
This methods cannot be invoked if the list is empty.
Implements ns3::Scheduler.
Scheduler::Event ns3::CalendarScheduler::RemoveNext | ( | void | ) | [virtual] |
This method cannot be invoked if the list is empty. Remove the next earliest event from the event list.
Implements ns3::Scheduler.
References IsEmpty(), NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.