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
scheduler.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005 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 SCHEDULER_H
22
#define SCHEDULER_H
23
24
#include <stdint.h>
25
#include "
object.h
"
26
35
namespace
ns3 {
36
37
class
EventImpl;
38
66
class
Scheduler
:
public
Object
67
{
68
public
:
73
static
TypeId
GetTypeId
(
void
);
74
79
struct
EventKey
80
{
81
uint64_t
m_ts
;
82
uint32_t
m_uid
;
83
uint32_t
m_context
;
84
};
92
struct
Event
93
{
94
EventImpl
*
impl
;
95
EventKey
key
;
96
};
97
99
virtual
~Scheduler
() = 0;
100
106
virtual
void
Insert
(
const
Event
&ev) = 0;
112
virtual
bool
IsEmpty
(
void
)
const
= 0;
121
virtual
Event
PeekNext
(
void
)
const
= 0;
129
virtual
Event
RemoveNext
(
void
) = 0;
137
virtual
void
Remove
(
const
Event
&ev) = 0;
138
};
139
153
inline
bool
operator <
(
const
Scheduler::EventKey
&a,
154
const
Scheduler::EventKey
&b)
155
{
156
if
(a.
m_ts
< b.
m_ts
)
157
{
158
return
true
;
159
}
160
else
if
(a.
m_ts
== b.
m_ts
161
&& a.
m_uid
< b.
m_uid
)
162
{
163
return
true
;
164
}
165
else
166
{
167
return
false
;
168
}
169
}
170
179
inline
bool
operator !=
(
const
Scheduler::EventKey
&a,
180
const
Scheduler::EventKey
&b)
181
{
182
return
a.
m_uid
!= b.
m_uid
;
183
}
184
192
inline
bool
operator >
(
const
Scheduler::EventKey
&a,
193
const
Scheduler::EventKey
&b)
194
{
195
if
(a.
m_ts
> b.
m_ts
)
196
{
197
return
true
;
198
}
199
else
if
(a.
m_ts
== b.
m_ts
200
&& a.
m_uid
> b.
m_uid
)
201
{
202
return
true
;
203
}
204
else
205
{
206
return
false
;
207
}
208
}
209
217
inline
bool
operator <
(
const
Scheduler::Event
&a,
218
const
Scheduler::Event
&b)
219
{
220
return
a.
key
< b.
key
;
221
}
222
223
224
}
// namespace ns3
225
226
227
#endif
/* SCHEDULER_H */
ns3::Scheduler::PeekNext
virtual Event PeekNext(void) const =0
Get a pointer to the next event.
ns3::Scheduler::EventKey::m_ts
uint64_t m_ts
Event time stamp.
Definition:
scheduler.h:81
ns3::Scheduler::Event::impl
EventImpl * impl
Pointer to the event implementation.
Definition:
scheduler.h:94
ns3::operator>
bool operator>(const Time &lhs, const Time &rhs)
Definition:
nstime.h:752
ns3::Scheduler::IsEmpty
virtual bool IsEmpty(void) const =0
Test if the schedule is empty.
ns3::Scheduler::RemoveNext
virtual Event RemoveNext(void)=0
Remove the earliest event from the event list.
ns3::Scheduler::Remove
virtual void Remove(const Event &ev)=0
Remove a specific event from the event list.
ns3::Scheduler::Event::key
EventKey key
Key for sorting and ordering Events.
Definition:
scheduler.h:95
ns3::Scheduler::EventKey::m_uid
uint32_t m_uid
Event unique id.
Definition:
scheduler.h:82
ns3::Scheduler::Insert
virtual void Insert(const Event &ev)=0
Insert a new Event in the schedule.
ns3::Scheduler::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
scheduler.cc:43
ns3::Scheduler
Maintain the event list.
Definition:
scheduler.h:66
ns3::Scheduler::Event
Scheduler event.
Definition:
scheduler.h:92
ns3::operator!=
bool operator!=(const BleAccessAddress &a, const BleAccessAddress &b)
Definition:
ble-access-address.h:164
ns3::operator<
bool operator<(const BleAccessAddress &a, const BleAccessAddress &b)
Definition:
ble-access-address.h:168
object.h
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
ns3::EventImpl
A simulation event.
Definition:
event-impl.h:44
ns3::Scheduler::~Scheduler
virtual ~Scheduler()=0
Destructor.
Definition:
scheduler.cc:37
ns3::Scheduler::EventKey
Structure for sorting and comparing Events.
Definition:
scheduler.h:79
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:87
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::Scheduler::EventKey::m_context
uint32_t m_context
Event context.
Definition:
scheduler.h:83
src
core
model
scheduler.h
Generated on Wed Jul 6 2016 17:11:26 for ns-3 by
1.8.6