remove GetEventImpl
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 27 Jul 2007 17:44:15 +0200
changeset 1012 7b923896f33b
parent 1011 7e5be9b118c9
child 1013 3eb895b2032a
remove GetEventImpl
src/simulator/event-id.cc
src/simulator/event-id.h
src/simulator/scheduler-heap.cc
src/simulator/scheduler-list.cc
src/simulator/scheduler-map.cc
src/simulator/simulator.cc
--- a/src/simulator/event-id.cc	Fri Jul 27 17:36:14 2007 +0200
+++ b/src/simulator/event-id.cc	Fri Jul 27 17:44:15 2007 +0200
@@ -50,11 +50,6 @@
 {
   return !IsExpired ();
 }
-Ptr<EventImpl> 
-EventId::GetEventImpl (void) const
-{
-  return m_eventImpl;
-}
 EventImpl *
 EventId::PeekEventImpl (void) const
 {
--- a/src/simulator/event-id.h	Fri Jul 27 17:36:14 2007 +0200
+++ b/src/simulator/event-id.h	Fri Jul 27 17:44:15 2007 +0200
@@ -53,7 +53,6 @@
    * they are supposed to be invoked only by
    * subclasses of the Scheduler base class.
    */
-  Ptr<EventImpl> GetEventImpl (void) const;
   EventImpl *PeekEventImpl (void) const;
   uint64_t GetTs (void) const;
   uint32_t GetUid (void) const;
--- a/src/simulator/scheduler-heap.cc	Fri Jul 27 17:36:14 2007 +0200
+++ b/src/simulator/scheduler-heap.cc	Fri Jul 27 17:44:15 2007 +0200
@@ -226,7 +226,8 @@
 SchedulerHeap::Insert (const EventId &id)
 {
   // acquire single ref
-  EventImpl *event = GetPointer (id.GetEventImpl ());
+  EventImpl *event = id.PeekEventImpl ();
+  event->Ref ();
   Scheduler::EventKey key;
   key.m_ts = id.GetTs ();
   key.m_uid = id.GetUid ();
@@ -259,7 +260,7 @@
     {
       if (uid == m_heap[i].second.m_uid)
         {
-          NS_ASSERT (m_heap[i].first == id.GetEventImpl ());
+          NS_ASSERT (m_heap[i].first == id.PeekEventImpl ());
           std::pair<EventImpl *,Scheduler::EventKey> next = m_heap[i];
           // release single ref
           next.first->Unref ();
--- a/src/simulator/scheduler-list.cc	Fri Jul 27 17:36:14 2007 +0200
+++ b/src/simulator/scheduler-list.cc	Fri Jul 27 17:44:15 2007 +0200
@@ -71,7 +71,8 @@
 {
   Scheduler::EventKey key;
   // acquire refcount on EventImpl
-  EventImpl *event = GetPointer (id.GetEventImpl ());
+  EventImpl *event = id.PeekEventImpl ();
+  event->Ref ();
   key.m_ts = id.GetTs ();
   key.m_uid = id.GetUid ();
   for (EventsI i = m_events.begin (); i != m_events.end (); i++) 
@@ -111,7 +112,7 @@
     {
       if (i->second.m_uid == id.GetUid ())
         {
-          NS_ASSERT (id.GetEventImpl () == i->first);
+          NS_ASSERT (id.PeekEventImpl () == i->first);
           // release single acquire ref.
           i->first->Unref ();
           m_events.erase (i);
--- a/src/simulator/scheduler-map.cc	Fri Jul 27 17:36:14 2007 +0200
+++ b/src/simulator/scheduler-map.cc	Fri Jul 27 17:44:15 2007 +0200
@@ -91,7 +91,8 @@
 SchedulerMap::Insert (const EventId &id)
 {
   // acquire a single ref
-  EventImpl *event = GetPointer (id.GetEventImpl ());
+  EventImpl *event = id.PeekEventImpl ();
+  event->Ref ();
   Scheduler::EventKey key;
   key.m_ts = id.GetTs ();
   key.m_uid = id.GetUid ();
@@ -129,7 +130,7 @@
   key.m_ts = id.GetTs ();
   key.m_uid = id.GetUid ();
   EventMapI i = m_list.find (key);
-  NS_ASSERT (i->second == id.GetEventImpl ());
+  NS_ASSERT (i->second == id.PeekEventImpl ());
   // release single ref.
   i->second->Unref ();
   m_list.erase (i);
--- a/src/simulator/simulator.cc	Fri Jul 27 17:36:14 2007 +0200
+++ b/src/simulator/simulator.cc	Fri Jul 27 17:44:15 2007 +0200
@@ -115,7 +115,7 @@
 {
   while (!m_destroyEvents.empty ()) 
     {
-      Ptr<EventImpl> ev = m_destroyEvents.front ().GetEventImpl ();
+      Ptr<EventImpl> ev = m_destroyEvents.front ().PeekEventImpl ();
       m_destroyEvents.pop_front ();
       TRACE ("handle destroy " << ev);
       if (!ev->IsCancelled ())
@@ -288,7 +288,7 @@
 {
   if (!IsExpired (id))
     {
-      id.GetEventImpl ()->Cancel ();
+      id.PeekEventImpl ()->Cancel ();
     }
 }
 
@@ -307,11 +307,11 @@
          }
       return true;
     }
-  if (ev.GetEventImpl () == 0 ||
+  if (ev.PeekEventImpl () == 0 ||
       ev.GetTs () < m_currentTs ||
       (ev.GetTs () == m_currentTs &&
        ev.GetUid () <= m_currentUid) ||
-      ev.GetEventImpl ()->IsCancelled ()) 
+      ev.PeekEventImpl ()->IsCancelled ()) 
     {
       return true;
     }