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
27
namespace
ns3 {
28
29
class
EventImpl;
30
57
class
Scheduler
:
public
Object
58
{
59
public
:
60
static
TypeId
GetTypeId
(
void
);
61
63
struct
EventKey
64
{
65
uint64_t
m_ts
;
66
uint32_t
m_uid
;
67
uint32_t
m_context
;
68
};
70
struct
Event
71
{
72
EventImpl
*
impl
;
73
EventKey
key
;
74
};
75
76
virtual
~Scheduler
() = 0;
77
81
virtual
void
Insert
(
const
Event
&ev) = 0;
85
virtual
bool
IsEmpty
(
void
)
const
= 0;
92
virtual
Event
PeekNext
(
void
)
const
= 0;
97
virtual
Event
RemoveNext
(
void
) = 0;
103
virtual
void
Remove
(
const
Event
&ev) = 0;
104
};
105
106
/* Note the invariants which this function must provide:
107
* - irreflexibility: f (x,x) is false)
108
* - antisymmetry: f(x,y) = !f(y,x)
109
* - transitivity: f(x,y) and f(y,z) => f(x,z)
110
*/
111
inline
bool
operator <
(
const
Scheduler::EventKey
&a,
const
Scheduler::EventKey
&b)
112
{
113
if
(a.
m_ts
< b.
m_ts
)
114
{
115
return
true
;
116
}
117
else
if
(a.
m_ts
== b.
m_ts
118
&& a.
m_uid
< b.
m_uid
)
119
{
120
return
true
;
121
}
122
else
123
{
124
return
false
;
125
}
126
}
127
inline
bool
operator !=
(
const
Scheduler::EventKey
&a,
const
Scheduler::EventKey
&b)
128
{
129
return
a.
m_uid
!= b.
m_uid
;
130
}
131
inline
bool
operator >
(
const
Scheduler::EventKey
&a,
const
Scheduler::EventKey
&b)
132
{
133
if
(a.
m_ts
> b.
m_ts
)
134
{
135
return
true
;
136
}
137
else
if
(a.
m_ts
== b.
m_ts
138
&& a.
m_uid
> b.
m_uid
)
139
{
140
return
true
;
141
}
142
else
143
{
144
return
false
;
145
}
146
}
147
148
149
150
inline
bool
operator <
(
const
Scheduler::Event
&a,
const
Scheduler::Event
&b)
151
{
152
return
a.
key
< b.
key
;
153
}
154
155
156
}
// namespace ns3
157
158
159
#endif
/* SCHEDULER_H */
ns3::Scheduler::PeekNext
virtual Event PeekNext(void) const =0
ns3::Scheduler::EventKey::m_ts
uint64_t m_ts
Definition:
scheduler.h:65
ns3::Scheduler::Event::impl
EventImpl * impl
Definition:
scheduler.h:72
ns3::operator>
bool operator>(const Time &lhs, const Time &rhs)
Definition:
nstime.h:645
ns3::Scheduler::IsEmpty
virtual bool IsEmpty(void) const =0
ns3::operator<
bool operator<(const Room &a, const Room &b)
Definition:
building-position-allocator-test.cc:57
ns3::Scheduler::RemoveNext
virtual Event RemoveNext(void)=0
This method cannot be invoked if the list is empty.
ns3::Scheduler::Remove
virtual void Remove(const Event &ev)=0
ns3::Scheduler::Event::key
EventKey key
Definition:
scheduler.h:73
ns3::Scheduler::EventKey::m_uid
uint32_t m_uid
Definition:
scheduler.h:66
ns3::Scheduler::Insert
virtual void Insert(const Event &ev)=0
ns3::Scheduler::GetTypeId
static TypeId GetTypeId(void)
Definition:
scheduler.cc:38
ns3::Scheduler
Maintain the event list.
Definition:
scheduler.h:57
ns3::Scheduler::Event
Definition:
scheduler.h:70
ns3::operator!=
bool operator!=(Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > a, Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > b)
Inequality test.
Definition:
callback.h:1213
object.h
ns3::EventImpl
a simulation event
Definition:
event-impl.h:39
ns3::Scheduler::~Scheduler
virtual ~Scheduler()=0
Definition:
scheduler.cc:32
ns3::Scheduler::EventKey
Definition:
scheduler.h:63
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::Scheduler::EventKey::m_context
uint32_t m_context
Definition:
scheduler.h:67
src
core
model
scheduler.h
Generated on Sat Apr 19 2014 14:06:52 for ns-3 by
1.8.6