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
default-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) 2005,2006 INRIA
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
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#ifndef DEFAULT_SIMULATOR_IMPL_H
22
#define DEFAULT_SIMULATOR_IMPL_H
23
24
#include "
simulator-impl.h
"
25
#include "
scheduler.h
"
26
#include "
event-impl.h
"
27
#include "
system-thread.h
"
28
#include "ns3/system-mutex.h"
29
30
#include "
ptr.h
"
31
32
#include <list>
33
34
namespace
ns3 {
35
39
class
DefaultSimulatorImpl
:
public
SimulatorImpl
40
{
41
public
:
42
static
TypeId
GetTypeId
(
void
);
43
44
DefaultSimulatorImpl
();
45
~DefaultSimulatorImpl
();
46
47
virtual
void
Destroy
();
48
virtual
bool
IsFinished
(
void
)
const
;
49
virtual
void
Stop
(
void
);
50
virtual
void
Stop
(
Time
const
&time);
51
virtual
EventId
Schedule
(
Time
const
&time,
EventImpl
*event);
52
virtual
void
ScheduleWithContext
(uint32_t context,
Time
const
&time,
EventImpl
*event);
53
virtual
EventId
ScheduleNow
(
EventImpl
*event);
54
virtual
EventId
ScheduleDestroy
(
EventImpl
*event);
55
virtual
void
Remove
(
const
EventId
&ev);
56
virtual
void
Cancel
(
const
EventId
&ev);
57
virtual
bool
IsExpired
(
const
EventId
&ev)
const
;
58
virtual
void
Run
(
void
);
59
virtual
Time
Now
(
void
)
const
;
60
virtual
Time
GetDelayLeft
(
const
EventId
&
id
)
const
;
61
virtual
Time
GetMaximumSimulationTime
(
void
)
const
;
62
virtual
void
SetScheduler
(
ObjectFactory
schedulerFactory);
63
virtual
uint32_t
GetSystemId
(
void
)
const
;
64
virtual
uint32_t
GetContext
(
void
)
const
;
65
66
private
:
67
virtual
void
DoDispose
(
void
);
68
void
ProcessOneEvent
(
void
);
69
void
ProcessEventsWithContext
(
void
);
70
71
struct
EventWithContext
{
72
uint32_t
context
;
73
uint64_t
timestamp
;
74
EventImpl
*
event
;
75
};
76
typedef
std::list<struct EventWithContext>
EventsWithContext
;
77
EventsWithContext
m_eventsWithContext
;
78
bool
m_eventsWithContextEmpty
;
79
SystemMutex
m_eventsWithContextMutex
;
80
81
typedef
std::list<EventId>
DestroyEvents
;
82
DestroyEvents
m_destroyEvents
;
83
bool
m_stop
;
84
Ptr<Scheduler>
m_events
;
85
86
uint32_t
m_uid
;
87
uint32_t
m_currentUid
;
88
uint64_t
m_currentTs
;
89
uint32_t
m_currentContext
;
90
// number of events that have been inserted but not yet scheduled,
91
// not counting the "destroy" events; this is used for validation
92
int
m_unscheduledEvents
;
93
94
SystemThread::ThreadId
m_main
;
95
};
96
97
}
// namespace ns3
98
99
#endif
/* DEFAULT_SIMULATOR_IMPL_H */
src
core
model
default-simulator-impl.h
Generated on Fri Aug 30 2013 01:42:46 for ns-3 by
1.8.1.2