|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #ifndef CALENDAR_SCHEDULER_H
23 #define CALENDAR_SCHEDULER_H
108 virtual bool IsEmpty (
void)
const;
123 void Resize (uint32_t newSize);
137 void Init (uint32_t nBuckets,
146 inline uint32_t
Hash (uint64_t key)
const;
155 void DoResize (uint32_t newSize, uint64_t newWidth);
170 typedef std::list<Scheduler::Event>
Bucket;
a unique identifier for an interface.
bool m_reverse
Bucket ordering.
virtual Scheduler::Event RemoveNext(void)
Remove the earliest event from the event list.
Scheduler::Event DoRemoveNext(void)
Remove the earliest event.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Register this type.
std::list< Scheduler::Event > Bucket
Calendar bucket type: a list of Events.
void(* Pop)(Bucket &)
Pop the next event from the bucket, according to m_reverse.
virtual Scheduler::Event PeekNext(void) const
Get a pointer to the next event.
CalendarScheduler()
Constructor.
void DoResize(uint32_t newSize, uint64_t newWidth)
Resize the number of buckets and width.
ns3::Scheduler abstract base class, ns3::Scheduler::Event and ns3::Scheduler::EventKey declarations.
void ResizeDown(void)
Halve the number of buckets if necessary.
uint64_t m_lastPrio
The priority of the last event removed.
uint64_t m_bucketTop
Priority at the top of the bucket from which last event was dequeued.
void Resize(uint32_t newSize)
Resize to a new number of buckets, with automatically computed width.
uint32_t m_nBuckets
Number of buckets in the array.
Structure for sorting and comparing Events.
virtual void Remove(const Scheduler::Event &ev)
Remove a specific event from the event list.
void DoInsert(const Scheduler::Event &ev)
Insert a new event in to the correct bucket.
bool(* Order)(const EventKey &newEvent, const EventKey &it)
Ordering function to identify the insertion point, according to m_reverse.
void Init(uint32_t nBuckets, uint64_t width, uint64_t startPrio)
Initialize the calendar queue.
virtual void Insert(const Scheduler::Event &ev)
Insert a new Event in the schedule.
Bucket * m_buckets
Array of buckets.
uint32_t Hash(uint64_t key) const
Hash the dimensionless time to a bucket.
uint32_t m_lastBucket
Bucket index from which the last event was dequeued.
uint64_t m_width
Duration of a bucket, in dimensionless time units.
virtual bool IsEmpty(void) const
Test if the schedule is empty.
virtual ~CalendarScheduler()
Destructor.
void PrintInfo(void)
Print the configuration and bucket size distribution.
uint64_t CalculateNewWidth(void)
Compute the new bucket size, based on up to the first 25 entries.
void SetReverse(bool reverse)
Set the insertion order.
void ResizeUp(void)
Double the number of buckets if necessary.
uint32_t m_qSize
Number of events in queue.
a calendar queue event scheduler