A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
realtime-simulator-impl.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 University of Washington
4
*
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
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*/
18
19
#ifndef REALTIME_SIMULATOR_IMPL_H
20
#define REALTIME_SIMULATOR_IMPL_H
21
22
#include "
simulator-impl.h
"
23
#include "
system-thread.h
"
24
25
#include "
scheduler.h
"
26
#include "
synchronizer.h
"
27
#include "
event-impl.h
"
28
29
#include "
ptr.h
"
30
#include "
assert.h
"
31
#include "
log.h
"
32
#include "
system-mutex.h
"
33
34
#include <list>
35
36
namespace
ns3 {
37
41
class
RealtimeSimulatorImpl
:
public
SimulatorImpl
42
{
43
public
:
44
static
TypeId
GetTypeId
(
void
);
45
50
enum
SynchronizationMode
{
51
SYNC_BEST_EFFORT
,
52
SYNC_HARD_LIMIT
,
53
};
54
55
RealtimeSimulatorImpl
();
56
~RealtimeSimulatorImpl
();
57
58
virtual
void
Destroy
();
59
virtual
bool
IsFinished
(
void
)
const
;
60
virtual
void
Stop
(
void
);
61
virtual
void
Stop
(
Time
const
&time);
62
virtual
EventId
Schedule
(
Time
const
&time,
EventImpl
*event);
63
virtual
void
ScheduleWithContext
(uint32_t context,
Time
const
&time,
EventImpl
*event);
64
virtual
EventId
ScheduleNow
(
EventImpl
*event);
65
virtual
EventId
ScheduleDestroy
(
EventImpl
*event);
66
virtual
void
Remove
(
const
EventId
&ev);
67
virtual
void
Cancel
(
const
EventId
&ev);
68
virtual
bool
IsExpired
(
const
EventId
&ev)
const
;
69
virtual
void
Run
(
void
);
70
virtual
Time
Now
(
void
)
const
;
71
virtual
Time
GetDelayLeft
(
const
EventId
&
id
)
const
;
72
virtual
Time
GetMaximumSimulationTime
(
void
)
const
;
73
virtual
void
SetScheduler
(
ObjectFactory
schedulerFactory);
74
virtual
uint32_t
GetSystemId
(
void
)
const
;
75
virtual
uint32_t
GetContext
(
void
)
const
;
76
77
void
ScheduleRealtimeWithContext
(uint32_t context,
Time
const
&time,
EventImpl
*event);
78
void
ScheduleRealtime
(
Time
const
&time,
EventImpl
*event);
79
void
ScheduleRealtimeNowWithContext
(uint32_t context,
EventImpl
*event);
80
void
ScheduleRealtimeNow
(
EventImpl
*event);
81
Time
RealtimeNow
(
void
)
const
;
82
83
void
SetSynchronizationMode
(
RealtimeSimulatorImpl::SynchronizationMode
mode);
84
RealtimeSimulatorImpl::SynchronizationMode
GetSynchronizationMode
(
void
)
const
;
85
86
void
SetHardLimit
(
Time
limit);
87
Time
GetHardLimit
(
void
)
const
;
88
89
private
:
90
bool
Running
(
void
)
const
;
91
bool
Realtime
(
void
)
const
;
92
uint64_t
NextTs
(
void
)
const
;
93
void
ProcessOneEvent
(
void
);
94
virtual
void
DoDispose
(
void
);
95
96
typedef
std::list<EventId>
DestroyEvents
;
97
DestroyEvents
m_destroyEvents
;
98
bool
m_stop
;
99
bool
m_running
;
100
101
// The following variables are protected using the m_mutex
102
Ptr<Scheduler>
m_events
;
103
int
m_unscheduledEvents
;
104
uint32_t
m_uid
;
105
uint32_t
m_currentUid
;
106
uint64_t
m_currentTs
;
107
uint32_t
m_currentContext
;
108
109
mutable
SystemMutex
m_mutex
;
110
111
Ptr<Synchronizer>
m_synchronizer
;
112
116
SynchronizationMode
m_synchronizationMode
;
117
121
Time
m_hardLimit
;
122
123
SystemThread::ThreadId
m_main
;
124
};
125
126
}
// namespace ns3
127
128
#endif
/* REALTIME_SIMULATOR_IMPL_H */
src
core
model
realtime-simulator-impl.h
Generated on Fri Aug 30 2013 01:42:47 for ns-3 by
1.8.1.2