View | Details | Raw Unified | Return to bug 87
Collapse All | Expand All

(-)a/src/simulator/timer.cc (-4 / +8 lines)
 Lines 28-34   Timer::Timer () Link Here 
28
  : m_flags (0),
28
  : m_flags (0),
29
    m_delay (FemtoSeconds (0)),
29
    m_delay (FemtoSeconds (0)),
30
    m_event (),
30
    m_event (),
31
    m_impl (0)
31
    m_impl (0),
32
    m_collector (0)
32
{}
33
{}
33
34
34
Timer::Timer (enum SchedulePolicy schedulePolicy, 
35
Timer::Timer (enum SchedulePolicy schedulePolicy, 
 Lines 36-49   Timer::Timer (enum SchedulePolicy schedu Link Here 
36
  : m_flags (schedulePolicy | destroyPolicy),
37
  : m_flags (schedulePolicy | destroyPolicy),
37
    m_delay (FemtoSeconds (0)),
38
    m_delay (FemtoSeconds (0)),
38
    m_event (),
39
    m_event (),
39
    m_impl (0)
40
    m_impl (0),
41
    m_collector (0)
40
{}
42
{}
41
43
42
Timer::Timer (enum GarbageCollectPolicy policy)
44
Timer::Timer (enum GarbageCollectPolicy policy)
43
  : m_flags (GARBAGE_COLLECT),
45
  : m_flags (GARBAGE_COLLECT),
44
    m_delay (FemtoSeconds (0)),
46
    m_delay (FemtoSeconds (0)),
45
    m_event (),
47
    m_event (),
46
    m_impl (0)
48
    m_impl (0),
49
    m_collector (new EventGarbageCollector)
47
{}
50
{}
48
51
49
Timer::~Timer ()
52
Timer::~Timer ()
 Lines 63-68   Timer::~Timer () Link Here 
63
    {
66
    {
64
      Simulator::Remove (m_event);
67
      Simulator::Remove (m_event);
65
    }
68
    }
69
  delete m_collector;
66
  delete m_impl;
70
  delete m_impl;
67
}
71
}
68
72
 Lines 167-173   Timer::Schedule (Time delay) Link Here 
167
  m_event = m_impl->Schedule (delay);
171
  m_event = m_impl->Schedule (delay);
168
  if (m_flags & GARBAGE_COLLECT)
172
  if (m_flags & GARBAGE_COLLECT)
169
    {
173
    {
170
      SimulationSingleton<EventGarbageCollector>::Get ()->Track (m_event);
174
      m_collector->Track (m_event);
171
    }
175
    }
172
}
176
}
173
177
(-)a/src/simulator/timer.h (+2 lines)
 Lines 28-33   namespace ns3 { Link Here 
28
namespace ns3 {
28
namespace ns3 {
29
29
30
class TimerImpl;
30
class TimerImpl;
31
class EventGarbageCollector;
31
32
32
/**
33
/**
33
 * \brief a simple Timer class
34
 * \brief a simple Timer class
 Lines 295-300   private: Link Here 
295
  EventId m_event;
296
  EventId m_event;
296
  TimerImpl *m_impl;
297
  TimerImpl *m_impl;
297
  Time m_delayLeft;
298
  Time m_delayLeft;
299
  EventGarbageCollector *m_collector;
298
};
300
};
299
301
300
} // namespace ns3
302
} // namespace ns3

Return to bug 87