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
distributed-simulator-impl.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License version 2 as
5
* published by the Free Software Foundation;
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
*
16
* Author: George Riley <riley@ece.gatech.edu>
17
*/
18
19
#ifndef DISTRIBUTED_SIMULATOR_IMPL_H
20
#define DISTRIBUTED_SIMULATOR_IMPL_H
21
22
#include "ns3/simulator-impl.h"
23
#include "ns3/scheduler.h"
24
#include "ns3/event-impl.h"
25
#include "ns3/ptr.h"
26
27
#include <list>
28
29
namespace
ns3 {
30
36
class
LbtsMessage
37
{
38
public
:
39
LbtsMessage
()
40
:
m_txCount
(0),
41
m_rxCount
(0),
42
m_myId
(0)
43
{
44
}
45
52
LbtsMessage
(uint32_t rxc, uint32_t txc, uint32_t
id
,
const
Time
& t)
53
:
m_txCount
(txc),
54
m_rxCount
(rxc),
55
m_myId
(id),
56
m_smallestTime
(t)
57
{
58
}
59
60
~LbtsMessage
();
61
65
Time
GetSmallestTime
();
69
uint32_t
GetTxCount
();
73
uint32_t
GetRxCount
();
77
uint32_t
GetMyId
();
78
79
private
:
80
uint32_t
m_txCount
;
81
uint32_t
m_rxCount
;
82
uint32_t
m_myId
;
83
Time
m_smallestTime
;
84
};
85
91
class
DistributedSimulatorImpl
:
public
SimulatorImpl
92
{
93
public
:
94
static
TypeId
GetTypeId
(
void
);
95
96
DistributedSimulatorImpl
();
97
~DistributedSimulatorImpl
();
98
99
// virtual from SimulatorImpl
100
virtual
void
Destroy
();
101
virtual
bool
IsFinished
(
void
)
const
;
102
virtual
void
Stop
(
void
);
103
virtual
void
Stop
(
Time
const
&time);
104
virtual
EventId
Schedule
(
Time
const
&time,
EventImpl
*event);
105
virtual
void
ScheduleWithContext
(uint32_t context,
Time
const
&time,
EventImpl
*event);
106
virtual
EventId
ScheduleNow
(
EventImpl
*event);
107
virtual
EventId
ScheduleDestroy
(
EventImpl
*event);
108
virtual
void
Remove
(
const
EventId
&ev);
109
virtual
void
Cancel
(
const
EventId
&ev);
110
virtual
bool
IsExpired
(
const
EventId
&ev)
const
;
111
virtual
void
Run
(
void
);
112
virtual
Time
Now
(
void
)
const
;
113
virtual
Time
GetDelayLeft
(
const
EventId
&
id
)
const
;
114
virtual
Time
GetMaximumSimulationTime
(
void
)
const
;
115
virtual
void
SetScheduler
(
ObjectFactory
schedulerFactory);
116
virtual
uint32_t
GetSystemId
(
void
)
const
;
117
virtual
uint32_t
GetContext
(
void
)
const
;
118
119
private
:
120
virtual
void
DoDispose
(
void
);
121
void
CalculateLookAhead
(
void
);
122
123
void
ProcessOneEvent
(
void
);
124
uint64_t
NextTs
(
void
)
const
;
125
Time
Next
(
void
)
const
;
126
typedef
std::list<EventId>
DestroyEvents
;
127
128
DestroyEvents
m_destroyEvents
;
129
bool
m_stop
;
130
Ptr<Scheduler>
m_events
;
131
uint32_t
m_uid
;
132
uint32_t
m_currentUid
;
133
uint64_t
m_currentTs
;
134
uint32_t
m_currentContext
;
135
// number of events that have been inserted but not yet scheduled,
136
// not counting the "destroy" events; this is used for validation
137
int
m_unscheduledEvents
;
138
139
LbtsMessage
*
m_pLBTS
;
// Allocated once we know how many systems
140
uint32_t
m_myId
;
// MPI Rank
141
uint32_t
m_systemCount
;
// MPI Size
142
Time
m_grantedTime
;
// Last LBTS
143
static
Time
m_lookAhead
;
// Lookahead value
144
145
};
146
147
}
// namespace ns3
148
149
#endif
/* DISTRIBUTED_SIMULATOR_IMPL_H */
src
mpi
model
distributed-simulator-impl.h
Generated on Tue May 14 2013 11:08:29 for ns-3 by
1.8.1.2