21 #ifndef HEAP_SCHEDULER_H 22 #define HEAP_SCHEDULER_H 69 virtual bool IsEmpty (
void)
const;
84 inline std::size_t
Parent (std::size_t
id)
const;
91 std::size_t
Sibling (std::size_t
id)
const;
98 inline std::size_t
LeftChild (std::size_t
id)
const;
105 inline std::size_t
RightChild (std::size_t
id)
const;
111 inline std::size_t
Root (
void)
const;
116 std::size_t
Last (
void)
const;
123 inline bool IsRoot (std::size_t
id)
const;
130 inline bool IsBottom (std::size_t
id)
const;
146 inline std::size_t
Smallest (std::size_t a, std::size_t b)
const;
153 inline void Exch (std::size_t a, std::size_t b);
virtual Scheduler::Event PeekNext(void) const
Get a pointer to the next event.
virtual ~HeapScheduler()
Destructor.
std::size_t Last(void) const
Return the index of the last element.
bool IsRoot(std::size_t id) const
Test if an index is the root.
std::size_t Parent(std::size_t id) const
Get the parent index of a given entry.
virtual Scheduler::Event RemoveNext(void)
Remove the earliest event from the event list.
std::size_t Sibling(std::size_t id) const
Get the next sibling of a given entry.
static TypeId GetTypeId(void)
Register this type.
bool IsLessStrictly(std::size_t a, std::size_t b) const
Compare (less than) two items.
ns3::Scheduler abstract base class, ns3::Scheduler::Event and ns3::Scheduler::EventKey declarations...
a binary heap event scheduler
virtual void Insert(const Scheduler::Event &ev)
Insert a new Event in the schedule.
std::size_t RightChild(std::size_t id) const
Get the right child index of a given entry.
std::size_t LeftChild(std::size_t id) const
Get the left child of a given entry.
BinaryHeap m_heap
The event list.
void Exch(std::size_t a, std::size_t b)
Swap two items.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
HeapScheduler()
Constructor.
std::size_t Root(void) const
Get the root index of the heap.
virtual bool IsEmpty(void) const
Test if the schedule is empty.
bool IsBottom(std::size_t id) const
Test if an index is at the bottom of the heap.
virtual void Remove(const Scheduler::Event &ev)
Remove a specific event from the event list.
void BottomUp(void)
Percolate a newly inserted Last item to its proper position.
std::size_t Smallest(std::size_t a, std::size_t b) const
Minimum of two items.
a unique identifier for an interface.
std::vector< Scheduler::Event > BinaryHeap
Event list type: vector of Events, managed as a heap.
void TopDown(std::size_t start)
Percolate a deletion bubble down the heap.