author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 28 Jul 2008 08:54:20 -0700 | |
changeset 3489 | b5ef00370c70 |
parent 3470 | 21022872009d |
child 3494 | b198b3d06e86 |
permissions | -rw-r--r-- |
3470
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
2 |
/* |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2005,2006 INRIA |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
4 |
* |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
8 |
* |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
13 |
* |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
17 |
* |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
19 |
*/ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
20 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
21 |
#include "simulator.h" |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
22 |
#include "default-simulator-impl.h" |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
23 |
#include "scheduler.h" |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
24 |
#include "event-impl.h" |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
25 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
26 |
#include "ns3/ptr.h" |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
27 |
#include "ns3/pointer.h" |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
28 |
#include "ns3/assert.h" |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
29 |
#include "ns3/log.h" |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
30 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
31 |
#include <math.h> |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
32 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
33 |
NS_LOG_COMPONENT_DEFINE ("DefaultSimulatorImpl"); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
34 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
35 |
namespace ns3 { |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
36 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
37 |
NS_OBJECT_ENSURE_REGISTERED (DefaultSimulatorImpl); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
38 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
39 |
TypeId |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
40 |
DefaultSimulatorImpl::GetTypeId (void) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
41 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
42 |
static TypeId tid = TypeId ("ns3::DefaultSimulatorImpl") |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
43 |
.SetParent<Object> () |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
44 |
.AddConstructor<DefaultSimulatorImpl> () |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
45 |
; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
46 |
return tid; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
47 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
48 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
49 |
DefaultSimulatorImpl::DefaultSimulatorImpl () |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
50 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
51 |
m_stop = false; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
52 |
m_stopAt = 0; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
53 |
// uids are allocated from 4. |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
54 |
// uid 0 is "invalid" events |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
55 |
// uid 1 is "now" events |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
56 |
// uid 2 is "destroy" events |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
57 |
m_uid = 4; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
58 |
// before ::Run is entered, the m_currentUid will be zero |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
59 |
m_currentUid = 0; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
60 |
m_currentTs = 0; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
61 |
m_unscheduledEvents = 0; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
62 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
63 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
64 |
DefaultSimulatorImpl::~DefaultSimulatorImpl () |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
65 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
66 |
while (!m_events->IsEmpty ()) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
67 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
68 |
EventId next = m_events->RemoveNext (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
69 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
70 |
m_events = 0; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
71 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
72 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
73 |
void |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
74 |
DefaultSimulatorImpl::Destroy () |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
75 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
76 |
while (!m_destroyEvents.empty ()) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
77 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
78 |
Ptr<EventImpl> ev = m_destroyEvents.front ().PeekEventImpl (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
79 |
m_destroyEvents.pop_front (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
80 |
NS_LOG_LOGIC ("handle destroy " << ev); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
81 |
if (!ev->IsCancelled ()) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
82 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
83 |
ev->Invoke (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
84 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
85 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
86 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
87 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
88 |
void |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
89 |
DefaultSimulatorImpl::SetScheduler (Ptr<Scheduler> scheduler) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
90 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
91 |
if (m_events != 0) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
92 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
93 |
while (!m_events->IsEmpty ()) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
94 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
95 |
EventId next = m_events->RemoveNext (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
96 |
scheduler->Insert (next); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
97 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
98 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
99 |
m_events = scheduler; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
100 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
101 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
102 |
Ptr<Scheduler> |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
103 |
DefaultSimulatorImpl::GetScheduler (void) const |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
104 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
105 |
return m_events; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
106 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
107 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
108 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
109 |
void |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
110 |
DefaultSimulatorImpl::ProcessOneEvent (void) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
111 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
112 |
EventId next = m_events->RemoveNext (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
113 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
114 |
NS_ASSERT (next.GetTs () >= m_currentTs); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
115 |
--m_unscheduledEvents; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
116 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
117 |
NS_LOG_LOGIC ("handle " << next.GetTs ()); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
118 |
m_currentTs = next.GetTs (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
119 |
m_currentUid = next.GetUid (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
120 |
EventImpl *event = next.PeekEventImpl (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
121 |
event->Invoke (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
122 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
123 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
124 |
bool |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
125 |
DefaultSimulatorImpl::IsFinished (void) const |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
126 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
127 |
return m_events->IsEmpty (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
128 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
129 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
130 |
uint64_t |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
131 |
DefaultSimulatorImpl::NextTs (void) const |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
132 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
133 |
NS_ASSERT (!m_events->IsEmpty ()); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
134 |
EventId id = m_events->PeekNext (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
135 |
return id.GetTs (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
136 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
137 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
138 |
Time |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
139 |
DefaultSimulatorImpl::Next (void) const |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
140 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
141 |
return TimeStep (NextTs ()); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
142 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
143 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
144 |
void |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
145 |
DefaultSimulatorImpl::Run (void) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
146 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
147 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
148 |
while (!m_events->IsEmpty () && !m_stop && |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
149 |
(m_stopAt == 0 || m_stopAt > NextTs ())) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
150 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
151 |
ProcessOneEvent (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
152 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
153 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
154 |
// If the simulator stopped naturally by lack of events, make a |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
155 |
// consistency test to check that we didn't lose any events along the way. |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
156 |
NS_ASSERT(!m_events->IsEmpty () || m_unscheduledEvents == 0); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
157 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
158 |
m_log.close (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
159 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
160 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
161 |
void |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
162 |
DefaultSimulatorImpl::Stop (void) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
163 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
164 |
m_stop = true; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
165 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
166 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
167 |
void |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
168 |
DefaultSimulatorImpl::Stop (Time const &time) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
169 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
170 |
NS_ASSERT (time.IsPositive ()); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
171 |
Time absolute = Simulator::Now () + time; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
172 |
m_stopAt = absolute.GetTimeStep (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
173 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
174 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
175 |
EventId |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
176 |
DefaultSimulatorImpl::Schedule (Time const &time, const Ptr<EventImpl> &event) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
177 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
178 |
NS_ASSERT (time.IsPositive ()); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
179 |
NS_ASSERT (time >= TimeStep (m_currentTs)); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
180 |
uint64_t ts = (uint64_t) time.GetTimeStep (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
181 |
EventId id (event, ts, m_uid); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
182 |
m_uid++; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
183 |
++m_unscheduledEvents; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
184 |
m_events->Insert (id); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
185 |
return id; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
186 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
187 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
188 |
EventId |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
189 |
DefaultSimulatorImpl::ScheduleNow (const Ptr<EventImpl> &event) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
190 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
191 |
EventId id (event, m_currentTs, m_uid); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
192 |
m_uid++; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
193 |
++m_unscheduledEvents; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
194 |
m_events->Insert (id); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
195 |
return id; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
196 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
197 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
198 |
EventId |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
199 |
DefaultSimulatorImpl::ScheduleDestroy (const Ptr<EventImpl> &event) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
200 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
201 |
EventId id (event, m_currentTs, 2); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
202 |
m_destroyEvents.push_back (id); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
203 |
m_uid++; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
204 |
return id; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
205 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
206 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
207 |
Time |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
208 |
DefaultSimulatorImpl::Now (void) const |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
209 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
210 |
return TimeStep (m_currentTs); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
211 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
212 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
213 |
Time |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
214 |
DefaultSimulatorImpl::GetDelayLeft (const EventId &id) const |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
215 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
216 |
if (IsExpired (id)) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
217 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
218 |
return TimeStep (0); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
219 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
220 |
else |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
221 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
222 |
return TimeStep (id.GetTs () - m_currentTs); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
223 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
224 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
225 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
226 |
void |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
227 |
DefaultSimulatorImpl::Remove (const EventId &ev) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
228 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
229 |
if (ev.GetUid () == 2) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
230 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
231 |
// destroy events. |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
232 |
for (DestroyEvents::iterator i = m_destroyEvents.begin (); i != m_destroyEvents.end (); i++) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
233 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
234 |
if (*i == ev) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
235 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
236 |
m_destroyEvents.erase (i); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
237 |
break; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
238 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
239 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
240 |
return; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
241 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
242 |
if (IsExpired (ev)) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
243 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
244 |
return; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
245 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
246 |
m_events->Remove (ev); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
247 |
Cancel (ev); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
248 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
249 |
--m_unscheduledEvents; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
250 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
251 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
252 |
void |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
253 |
DefaultSimulatorImpl::Cancel (const EventId &id) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
254 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
255 |
if (!IsExpired (id)) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
256 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
257 |
id.PeekEventImpl ()->Cancel (); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
258 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
259 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
260 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
261 |
bool |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
262 |
DefaultSimulatorImpl::IsExpired (const EventId &ev) const |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
263 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
264 |
if (ev.GetUid () == 2) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
265 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
266 |
// destroy events. |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
267 |
for (DestroyEvents::const_iterator i = m_destroyEvents.begin (); i != m_destroyEvents.end (); i++) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
268 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
269 |
if (*i == ev) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
270 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
271 |
return false; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
272 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
273 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
274 |
return true; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
275 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
276 |
if (ev.PeekEventImpl () == 0 || |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
277 |
ev.GetTs () < m_currentTs || |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
278 |
(ev.GetTs () == m_currentTs && |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
279 |
ev.GetUid () <= m_currentUid) || |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
280 |
ev.PeekEventImpl ()->IsCancelled ()) |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
281 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
282 |
return true; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
283 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
284 |
else |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
285 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
286 |
return false; |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
287 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
288 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
289 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
290 |
Time |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
291 |
DefaultSimulatorImpl::GetMaximumSimulationTime (void) const |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
292 |
{ |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
293 |
// XXX: I am fairly certain other compilers use other non-standard |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
294 |
// post-fixes to indicate 64 bit constants. |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
295 |
return TimeStep (0x7fffffffffffffffLL); |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
296 |
} |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
297 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
298 |
}; // namespace ns3 |
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
299 |
|
21022872009d
make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
300 |