LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // uid 2 is "destroy" events | 55 // uid 2 is "destroy" events |
56 m_uid = 4; | 56 m_uid = 4; |
57 // before ::Run is entered, the m_currentUid will be zero | 57 // before ::Run is entered, the m_currentUid will be zero |
58 m_currentUid = 0; | 58 m_currentUid = 0; |
59 m_currentTs = 0; | 59 m_currentTs = 0; |
60 m_currentContext = 0xffffffff; | 60 m_currentContext = 0xffffffff; |
61 m_unscheduledEvents = 0; | 61 m_unscheduledEvents = 0; |
62 } | 62 } |
63 | 63 |
64 DefaultSimulatorImpl::~DefaultSimulatorImpl () | 64 DefaultSimulatorImpl::~DefaultSimulatorImpl () |
| 65 {} |
| 66 |
| 67 void· |
| 68 DefaultSimulatorImpl::DoDispose (void) |
65 { | 69 { |
66 while (!m_events->IsEmpty ()) | 70 while (!m_events->IsEmpty ()) |
67 { | 71 { |
68 Scheduler::Event next = m_events->RemoveNext (); | 72 Scheduler::Event next = m_events->RemoveNext (); |
69 next.impl->Unref (); | 73 next.impl->Unref (); |
70 } | 74 } |
71 m_events = 0; | 75 m_events = 0; |
72 } | 76 SimulatorImpl::DoDispose (); |
73 | 77 } |
74 void | 78 void |
75 DefaultSimulatorImpl::Destroy () | 79 DefaultSimulatorImpl::Destroy () |
76 { | 80 { |
77 while (!m_destroyEvents.empty ())· | 81 while (!m_destroyEvents.empty ())· |
78 { | 82 { |
79 Ptr<EventImpl> ev = m_destroyEvents.front ().PeekEventImpl (); | 83 Ptr<EventImpl> ev = m_destroyEvents.front ().PeekEventImpl (); |
80 m_destroyEvents.pop_front (); | 84 m_destroyEvents.pop_front (); |
81 NS_LOG_LOGIC ("handle destroy " << ev); | 85 NS_LOG_LOGIC ("handle destroy " << ev); |
82 if (!ev->IsCancelled ()) | 86 if (!ev->IsCancelled ()) |
83 { | 87 { |
(...skipping 12 matching lines...) Expand all Loading... |
96 while (!m_events->IsEmpty ()) | 100 while (!m_events->IsEmpty ()) |
97 { | 101 { |
98 Scheduler::Event next = m_events->RemoveNext (); | 102 Scheduler::Event next = m_events->RemoveNext (); |
99 scheduler->Insert (next); | 103 scheduler->Insert (next); |
100 } | 104 } |
101 } | 105 } |
102 m_events = scheduler; | 106 m_events = scheduler; |
103 } | 107 } |
104 | 108 |
105 // System ID for non-distributed simulation is always zero | 109 // System ID for non-distributed simulation is always zero |
106 uint32_t DefaultSimulatorImpl::GetSystemId (void) const | 110 uint32_t |
| 111 DefaultSimulatorImpl::GetSystemId (void) const |
107 { | 112 { |
108 return 0; | 113 return 0; |
109 } | 114 } |
110 | 115 |
111 void | 116 void |
112 DefaultSimulatorImpl::ProcessOneEvent (void) | 117 DefaultSimulatorImpl::ProcessOneEvent (void) |
113 { | 118 { |
114 Scheduler::Event next = m_events->RemoveNext (); | 119 Scheduler::Event next = m_events->RemoveNext (); |
115 | 120 |
116 NS_ASSERT (next.key.m_ts >= m_currentTs); | 121 NS_ASSERT (next.key.m_ts >= m_currentTs); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 345 |
341 uint32_t | 346 uint32_t |
342 DefaultSimulatorImpl::GetContext (void) const | 347 DefaultSimulatorImpl::GetContext (void) const |
343 { | 348 { |
344 return m_currentContext; | 349 return m_currentContext; |
345 } | 350 } |
346 | 351 |
347 } // namespace ns3 | 352 } // namespace ns3 |
348 | 353 |
349 | 354 |
LEFT | RIGHT |