A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
event-id.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005 INRIA
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
#ifndef EVENT_ID_H
20
#define EVENT_ID_H
21
22
#include "
event-impl.h
"
23
#include "
ptr.h
"
24
25
#include <stdint.h>
26
33
namespace
ns3
34
{
35
36
class
EventImpl;
37
54
class
EventId
55
{
56
public
:
58
enum
UID
59
{
61
INVALID
= 0,
63
NOW
= 1,
65
DESTROY
= 2,
67
RESERVED
= 3,
69
VALID
= 4
70
};
71
73
EventId
();
82
EventId
(
const
Ptr<EventImpl>
& impl, uint64_t ts,
uint32_t
context,
uint32_t
uid);
87
void
Cancel
();
92
void
Remove
();
98
bool
IsExpired
()
const
;
104
bool
IsRunning
()
const
;
105
106
public
:
114
EventImpl
*
PeekEventImpl
()
const
;
116
uint64_t
GetTs
()
const
;
118
uint32_t
GetContext
()
const
;
120
uint32_t
GetUid
()
const
;
129
friend
bool
operator==
(
const
EventId
& a,
const
EventId
& b);
136
friend
bool
operator!=
(
const
EventId
& a,
const
EventId
& b);
143
friend
bool
operator<
(
const
EventId
& a,
const
EventId
& b);
144
145
private
:
146
Ptr<EventImpl>
m_eventImpl
;
147
uint64_t
m_ts
;
148
uint32_t
m_context
;
149
uint32_t
m_uid
;
150
};
151
152
/*************************************************
153
** Inline implementations
154
************************************************/
155
156
inline
bool
157
operator==
(
const
EventId
& a,
const
EventId
& b)
158
{
159
return
a.
m_uid
== b.
m_uid
&& a.
m_context
== b.
m_context
&& a.
m_ts
== b.
m_ts
&&
160
a.
m_eventImpl
== b.
m_eventImpl
;
161
}
162
163
inline
bool
164
operator!=
(
const
EventId
& a,
const
EventId
& b)
165
{
166
return
!(a == b);
167
}
168
169
inline
bool
170
operator<
(
const
EventId
& a,
const
EventId
& b)
171
{
172
return
(a.
GetTs
() < b.
GetTs
());
173
}
174
175
}
// namespace ns3
176
177
#endif
/* EVENT_ID_H */
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:55
ns3::EventId::Cancel
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition:
event-id.cc:55
ns3::EventId::GetUid
uint32_t GetUid() const
Definition:
event-id.cc:104
ns3::EventId::UID
UID
Special values of the event UID.
Definition:
event-id.h:59
ns3::EventId::INVALID
@ INVALID
Invalid UID value.
Definition:
event-id.h:61
ns3::EventId::RESERVED
@ RESERVED
Reserved UID.
Definition:
event-id.h:67
ns3::EventId::VALID
@ VALID
Schedule(), etc.
Definition:
event-id.h:69
ns3::EventId::DESTROY
@ DESTROY
ScheduleDestroy() events.
Definition:
event-id.h:65
ns3::EventId::NOW
@ NOW
ScheduleNow() events.
Definition:
event-id.h:63
ns3::EventId::operator!=
friend bool operator!=(const EventId &a, const EventId &b)
Test if two EventId's are not equal.
Definition:
event-id.h:164
ns3::EventId::operator<
friend bool operator<(const EventId &a, const EventId &b)
Less than operator for two EventId's, based on time stamps.
Definition:
event-id.h:170
ns3::EventId::PeekEventImpl
EventImpl * PeekEventImpl() const
Definition:
event-id.cc:83
ns3::EventId::operator==
friend bool operator==(const EventId &a, const EventId &b)
Test if two EventId's are equal.
Definition:
event-id.h:157
ns3::EventId::IsExpired
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition:
event-id.cc:69
ns3::EventId::m_ts
uint64_t m_ts
The virtual time stamp.
Definition:
event-id.h:147
ns3::EventId::m_uid
uint32_t m_uid
The unique id.
Definition:
event-id.h:149
ns3::EventId::Remove
void Remove()
This method is syntactic sugar for the ns3::Simulator::Remove method.
Definition:
event-id.cc:62
ns3::EventId::IsRunning
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
Definition:
event-id.cc:76
ns3::EventId::GetContext
uint32_t GetContext() const
Definition:
event-id.cc:97
ns3::EventId::GetTs
uint64_t GetTs() const
Definition:
event-id.cc:90
ns3::EventId::EventId
EventId()
Default constructor.
Definition:
event-id.cc:36
ns3::EventId::m_context
uint32_t m_context
The context.
Definition:
event-id.h:148
ns3::EventId::m_eventImpl
Ptr< EventImpl > m_eventImpl
The underlying event implementation.
Definition:
event-id.h:146
ns3::EventImpl
A simulation event.
Definition:
event-impl.h:46
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:78
uint32_t
event-impl.h
ns3::EventImpl declarations.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator!=
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
Definition:
callback.h:676
ns3::operator==
bool operator==(const EventId &a, const EventId &b)
Definition:
event-id.h:157
ns3::operator<
bool operator<(const EventId &a, const EventId &b)
Definition:
event-id.h:170
ptr.h
ns3::Ptr smart pointer declaration and implementation.
src
core
model
event-id.h
Generated on Sun Jul 2 2023 18:21:31 for ns-3 by
1.9.6