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.cc
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
#include "
event-id.h
"
20
21
#include "
event-impl.h
"
22
#include "
log.h
"
23
#include "
simulator.h
"
24
31
namespace
ns3
32
{
33
34
NS_LOG_COMPONENT_DEFINE
(
"EventId"
);
35
36
EventId::EventId
()
37
: m_eventImpl(nullptr),
38
m_ts(0),
39
m_context(0),
40
m_uid(0)
41
{
42
NS_LOG_FUNCTION
(
this
);
43
}
44
45
EventId::EventId
(
const
Ptr<EventImpl>
& impl, uint64_t ts,
uint32_t
context,
uint32_t
uid)
46
: m_eventImpl(impl),
47
m_ts(ts),
48
m_context(context),
49
m_uid(uid)
50
{
51
NS_LOG_FUNCTION
(
this
<< impl << ts << context << uid);
52
}
53
54
void
55
EventId::Cancel
()
56
{
57
NS_LOG_FUNCTION
(
this
);
58
Simulator::Cancel
(*
this
);
59
}
60
61
void
62
EventId::Remove
()
63
{
64
NS_LOG_FUNCTION
(
this
);
65
Simulator::Remove
(*
this
);
66
}
67
68
bool
69
EventId::IsExpired
()
const
70
{
71
NS_LOG_FUNCTION
(
this
);
72
return
Simulator::IsExpired
(*
this
);
73
}
74
75
bool
76
EventId::IsRunning
()
const
77
{
78
NS_LOG_FUNCTION
(
this
);
79
return
!
IsExpired
();
80
}
81
82
EventImpl
*
83
EventId::PeekEventImpl
()
const
84
{
85
NS_LOG_FUNCTION
(
this
);
86
return
PeekPointer
(
m_eventImpl
);
87
}
88
89
uint64_t
90
EventId::GetTs
()
const
91
{
92
NS_LOG_FUNCTION
(
this
);
93
return
m_ts
;
94
}
95
96
uint32_t
97
EventId::GetContext
()
const
98
{
99
NS_LOG_FUNCTION
(
this
);
100
return
m_context
;
101
}
102
103
uint32_t
104
EventId::GetUid
()
const
105
{
106
NS_LOG_FUNCTION
(
this
);
107
return
m_uid
;
108
}
109
110
}
// namespace ns3
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::PeekEventImpl
EventImpl * PeekEventImpl() const
Definition:
event-id.cc:83
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
ns3::Simulator::Cancel
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition:
simulator.cc:276
ns3::Simulator::IsExpired
static bool IsExpired(const EventId &id)
Check if an event has already run or been cancelled.
Definition:
simulator.cc:286
ns3::Simulator::Remove
static void Remove(const EventId &id)
Remove an event from the event list.
Definition:
simulator.cc:266
uint32_t
event-id.h
ns3::EventId declarations.
event-impl.h
ns3::EventImpl declarations.
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:238
log.h
Debug message logging.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::PeekPointer
U * PeekPointer(const Ptr< U > &p)
Definition:
ptr.h:488
simulator.h
ns3::Simulator declaration.
src
core
model
event-id.cc
Generated on Sun Jul 2 2023 18:21:31 for ns-3 by
1.9.6