src/simulator/scheduler-heap.h
changeset 122 6b8f1eda5c57
parent 110 9ac6d63bfe33
child 131 f4fb87e77034
equal deleted inserted replaced
121:f8bc1a370b82 122:6b8f1eda5c57
    34 public:
    34 public:
    35     SchedulerHeap ();
    35     SchedulerHeap ();
    36     virtual ~SchedulerHeap ();
    36     virtual ~SchedulerHeap ();
    37 
    37 
    38 private:
    38 private:
    39     virtual EventId realInsert (EventImpl *event, Scheduler::EventKey key);
    39     virtual EventId RealInsert (EventImpl *event, Scheduler::EventKey key);
    40     virtual bool realIsEmpty (void) const;
    40     virtual bool RealIsEmpty (void) const;
    41     virtual EventImpl *realPeekNext (void) const;
    41     virtual EventImpl *RealPeekNext (void) const;
    42     virtual Scheduler::EventKey realPeekNextKey (void) const;
    42     virtual Scheduler::EventKey RealPeekNextKey (void) const;
    43     virtual void realRemoveNext (void);
    43     virtual void RealRemoveNext (void);
    44     virtual EventImpl *realRemove (EventId ev, Scheduler::EventKey *key);
    44     virtual EventImpl *RealRemove (EventId ev, Scheduler::EventKey *key);
    45     virtual bool realIsValid (EventId id);
    45     virtual bool RealIsValid (EventId id);
    46 
    46 
    47     typedef std::vector<std::pair<EventImpl *, Scheduler::EventKey> > BinaryHeap;
    47     typedef std::vector<std::pair<EventImpl *, Scheduler::EventKey> > BinaryHeap;
    48     inline void storeInEvent (EventImpl *ev, uint32_t index) const;
    48     inline void StoreInEvent (EventImpl *ev, uint32_t index) const;
    49     uint32_t getFrom_event (EventImpl *ev) const;
    49     uint32_t GetFromEvent (EventImpl *ev) const;
    50 
    50 
    51     inline uint32_t parent (uint32_t id) const;
    51     inline uint32_t Parent (uint32_t id) const;
    52     uint32_t sibling (uint32_t id) const;
    52     uint32_t Sibling (uint32_t id) const;
    53     inline uint32_t leftChild (uint32_t id) const;
    53     inline uint32_t LeftChild (uint32_t id) const;
    54     inline uint32_t rightChild (uint32_t id) const;
    54     inline uint32_t RightChild (uint32_t id) const;
    55     inline uint32_t root (void) const;
    55     inline uint32_t Root (void) const;
    56     uint32_t last (void) const;
    56     uint32_t Last (void) const;
    57     inline bool isRoot (uint32_t id) const;
    57     inline bool IsRoot (uint32_t id) const;
    58     inline bool isBottom (uint32_t id) const;
    58     inline bool IsBottom (uint32_t id) const;
    59     inline bool isLess (uint32_t a, uint32_t b);
    59     inline bool IsLess (uint32_t a, uint32_t b);
    60     inline uint32_t smallest (uint32_t a, uint32_t b);
    60     inline uint32_t Smallest (uint32_t a, uint32_t b);
    61 
    61 
    62     inline void exch (uint32_t a, uint32_t b);
    62     inline void Exch (uint32_t a, uint32_t b);
    63     void bottom_up (void);
    63     void BottomUp (void);
    64     void topDown (void);
    64     void TopDown (void);
    65 
    65 
    66     BinaryHeap m_heap;
    66     BinaryHeap m_heap;
    67 };
    67 };
    68 
    68 
    69 }; // namespace ns3
    69 }; // namespace ns3