21 #ifndef CALENDAR_SCHEDULER_H 22 #define CALENDAR_SCHEDULER_H 72 virtual bool IsEmpty (
void)
const;
87 void Resize (uint32_t newSize);
101 void Init (uint32_t nBuckets,
110 inline uint32_t
Hash (uint64_t key)
const;
119 void DoResize (uint32_t newSize, uint64_t newWidth);
134 typedef std::list<Scheduler::Event>
Bucket;
virtual void Insert(const Scheduler::Event &ev)
Insert a new Event in the schedule.
void ResizeDown(void)
Halve the number of buckets if necessary.
uint64_t CalculateNewWidth(void)
Compute the new bucket size, based on up to the first 25 entries.
uint32_t m_qSize
Number of events in queue.
void DoInsert(const Scheduler::Event &ev)
Insert a new event in to the correct bucket.
void ResizeUp(void)
Double the number of buckets if necessary.
virtual void Remove(const Scheduler::Event &ev)
Remove a specific event from the event list.
uint64_t m_bucketTop
Priority at the top of the bucket from which last event was dequeued.
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...
virtual ~CalendarScheduler()
Destructor.
virtual Scheduler::Event PeekNext(void) const
Get a pointer to the next event.
void Init(uint32_t nBuckets, uint64_t width, uint64_t startPrio)
Initialize the calendar queue.
CalendarScheduler()
Constructor.
uint64_t m_width
Duration of a bucket, in dimensionless time units.
void Resize(uint32_t newSize)
Resize to a new number of buckets, with automatically computed width.
uint32_t Hash(uint64_t key) const
Hash the dimensionless time to a bucket.
virtual Scheduler::Event RemoveNext(void)
Remove the earliest event from the event list.
Bucket * m_buckets
Array of buckets.
Scheduler::Event DoRemoveNext(void)
Remove the earliest event.
uint32_t m_lastBucket
Bucket index from which the last event was dequeued.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::list< Scheduler::Event > Bucket
Calendar bucket type: a list of Events.
static TypeId GetTypeId(void)
Register this type.
a calendar queue event scheduler
uint64_t m_lastPrio
The priority of the last event removed.
virtual bool IsEmpty(void) const
Test if the schedule is empty.
a unique identifier for an interface.
uint32_t m_nBuckets
Number of buckets in the array.
void PrintInfo(void)
Print the configuration and bucket size distribution.