--- a/src/simulator/heap-scheduler.cc Wed Oct 15 10:10:53 2008 +0200
+++ b/src/simulator/heap-scheduler.cc Wed Oct 15 10:11:32 2008 +0200
@@ -110,30 +110,9 @@
}
bool
-HeapScheduler::IsLowerStrictly (Scheduler::EventKey const*a, Scheduler::EventKey const*b) const
-{
- if (a->m_ts < b->m_ts)
- {
- return true;
- }
- else if (a->m_ts > b->m_ts)
- {
- return false;
- }
- else if (a->m_uid < b->m_uid)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool
HeapScheduler::IsLessStrictly (uint32_t a, uint32_t b) const
{
- return IsLowerStrictly (&m_heap[a].second, &m_heap[b].second);
+ return m_heap[a].second < m_heap[b].second;
}
uint32_t
--- a/src/simulator/heap-scheduler.h Wed Oct 15 10:10:53 2008 +0200
+++ b/src/simulator/heap-scheduler.h Wed Oct 15 10:11:32 2008 +0200
@@ -69,7 +69,6 @@
uint32_t Last (void) const;
inline bool IsRoot (uint32_t id) const;
inline bool IsBottom (uint32_t id) const;
- inline bool IsLowerStrictly (Scheduler::EventKey const*a, Scheduler::EventKey const*b) const;
inline bool IsLessStrictly (uint32_t a, uint32_t b) const;
inline uint32_t Smallest (uint32_t a, uint32_t b) const;
--- a/src/simulator/list-scheduler.cc Wed Oct 15 10:10:53 2008 +0200
+++ b/src/simulator/list-scheduler.cc Wed Oct 15 10:11:32 2008 +0200
@@ -32,24 +32,6 @@
ListScheduler::~ListScheduler ()
{}
-bool
-ListScheduler::IsLower (Scheduler::EventKey const*a, Scheduler::EventKey const*b) const
-{
- if (a->m_ts < b->m_ts)
- {
- return true;
- }
- else if (a->m_ts == b->m_ts &&
- a->m_uid < b->m_uid)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
void
ListScheduler::Insert (const EventId &id)
{
@@ -61,7 +43,7 @@
key.m_uid = id.GetUid ();
for (EventsI i = m_events.begin (); i != m_events.end (); i++)
{
- if (IsLower (&key, &i->second))
+ if (key < i->second)
{
m_events.insert (i, std::make_pair (event, key));
return;
--- a/src/simulator/list-scheduler.h Wed Oct 15 10:10:53 2008 +0200
+++ b/src/simulator/list-scheduler.h Wed Oct 15 10:11:32 2008 +0200
@@ -50,14 +50,13 @@
virtual bool Remove (const EventId &ev);
private:
- inline bool IsLower (Scheduler::EventKey const*a, Scheduler::EventKey const*b) const;
typedef std::list<std::pair<EventImpl*, EventKey> > Events;
typedef std::list<std::pair<EventImpl*, EventKey> >::iterator EventsI;
Events m_events;
};
-}; // namespace ns3
+} // namespace ns3
#endif /* SCHEDULER_LIST_H */
--- a/src/simulator/map-scheduler.cc Wed Oct 15 10:10:53 2008 +0200
+++ b/src/simulator/map-scheduler.cc Wed Oct 15 10:11:32 2008 +0200
@@ -42,34 +42,6 @@
MapScheduler::~MapScheduler ()
{}
-/* Note the invariants which this function must provide:
- * - irreflexibility: f (x,x) is false)
- * - antisymmetry: f(x,y) = !f(y,x)
- * - transitivity: f(x,y) and f(y,z) => f(x,z)
- */
-bool
-MapScheduler::EventKeyCompare::operator () (struct EventKey const&a, struct EventKey const&b)
-{
- if (a.m_ts < b.m_ts)
- {
- return true;
- }
- else if (a.m_ts > b.m_ts)
- {
- return false;
- }
- else if (a.m_uid < b.m_uid)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-
-
void
MapScheduler::Insert (const EventId &id)
{
--- a/src/simulator/map-scheduler.h Wed Oct 15 10:10:53 2008 +0200
+++ b/src/simulator/map-scheduler.h Wed Oct 15 10:11:32 2008 +0200
@@ -49,14 +49,9 @@
virtual bool Remove (const EventId &ev);
private:
- class EventKeyCompare {
- public:
- bool operator () (struct EventKey const&a, struct EventKey const&b);
- };
-
- typedef std::map<Scheduler::EventKey, EventImpl*, MapScheduler::EventKeyCompare> EventMap;
- typedef std::map<Scheduler::EventKey, EventImpl*, MapScheduler::EventKeyCompare>::iterator EventMapI;
- typedef std::map<Scheduler::EventKey, EventImpl*, MapScheduler::EventKeyCompare>::const_iterator EventMapCI;
+ typedef std::map<Scheduler::EventKey, EventImpl*> EventMap;
+ typedef std::map<Scheduler::EventKey, EventImpl*>::iterator EventMapI;
+ typedef std::map<Scheduler::EventKey, EventImpl*>::const_iterator EventMapCI;
EventMap m_list;
--- a/src/simulator/scheduler.h Wed Oct 15 10:10:53 2008 +0200
+++ b/src/simulator/scheduler.h Wed Oct 15 10:11:32 2008 +0200
@@ -90,7 +90,30 @@
virtual bool Remove (const EventId &id) = 0;
};
-}; // namespace ns3
+/* Note the invariants which this function must provide:
+ * - irreflexibility: f (x,x) is false)
+ * - antisymmetry: f(x,y) = !f(y,x)
+ * - transitivity: f(x,y) and f(y,z) => f(x,z)
+ */
+inline bool operator < (const Scheduler::EventKey &a, const Scheduler::EventKey &b)
+{
+ if (a.m_ts < b.m_ts)
+ {
+ return true;
+ }
+ else if (a.m_ts == b.m_ts &&
+ a.m_uid < b.m_uid)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+} // namespace ns3
#endif /* SCHEDULER_H */