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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#include "
event-id.h
"
9
10
#include "
event-impl.h
"
11
#include "
log.h
"
12
#include "
simulator.h
"
13
14
/**
15
* \file
16
* \ingroup events
17
* ns3::EventId implementation.
18
*/
19
20
namespace
ns3
21
{
22
23
NS_LOG_COMPONENT_DEFINE
(
"EventId"
);
24
25
EventId::EventId
()
26
: m_eventImpl(nullptr),
27
m_ts(0),
28
m_context(0),
29
m_uid(0)
30
{
31
NS_LOG_FUNCTION
(
this
);
32
}
33
34
EventId::EventId
(
const
Ptr<EventImpl>
& impl, uint64_t ts,
uint32_t
context,
uint32_t
uid)
35
: m_eventImpl(impl),
36
m_ts(ts),
37
m_context(context),
38
m_uid(uid)
39
{
40
NS_LOG_FUNCTION
(
this
<< impl << ts << context << uid);
41
}
42
43
void
44
EventId::Cancel
()
45
{
46
NS_LOG_FUNCTION
(
this
);
47
Simulator::Cancel
(*
this
);
48
}
49
50
void
51
EventId::Remove
()
52
{
53
NS_LOG_FUNCTION
(
this
);
54
Simulator::Remove
(*
this
);
55
}
56
57
bool
58
EventId::IsExpired
()
const
59
{
60
NS_LOG_FUNCTION
(
this
);
61
return
Simulator::IsExpired
(*
this
);
62
}
63
64
bool
65
EventId::IsPending
()
const
66
{
67
NS_LOG_FUNCTION
(
this
);
68
return
!
IsExpired
();
69
}
70
71
bool
72
EventId::IsRunning
()
const
73
{
74
return
IsPending
();
75
}
76
77
EventImpl
*
78
EventId::PeekEventImpl
()
const
79
{
80
NS_LOG_FUNCTION
(
this
);
81
return
PeekPointer
(
m_eventImpl
);
82
}
83
84
uint64_t
85
EventId::GetTs
()
const
86
{
87
NS_LOG_FUNCTION
(
this
);
88
return
m_ts
;
89
}
90
91
uint32_t
92
EventId::GetContext
()
const
93
{
94
NS_LOG_FUNCTION
(
this
);
95
return
m_context
;
96
}
97
98
uint32_t
99
EventId::GetUid
()
const
100
{
101
NS_LOG_FUNCTION
(
this
);
102
return
m_uid
;
103
}
104
105
}
// namespace ns3
ns3::EventId::Cancel
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition
event-id.cc:44
ns3::EventId::GetUid
uint32_t GetUid() const
Definition
event-id.cc:99
ns3::EventId::IsPending
bool IsPending() const
This method is syntactic sugar for !IsExpired().
Definition
event-id.cc:65
ns3::EventId::PeekEventImpl
EventImpl * PeekEventImpl() const
Definition
event-id.cc:78
ns3::EventId::IsExpired
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition
event-id.cc:58
ns3::EventId::m_ts
uint64_t m_ts
The virtual time stamp.
Definition
event-id.h:145
ns3::EventId::m_uid
uint32_t m_uid
The unique id.
Definition
event-id.h:147
ns3::EventId::Remove
void Remove()
This method is syntactic sugar for the ns3::Simulator::Remove method.
Definition
event-id.cc:51
ns3::EventId::IsRunning
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
Definition
event-id.cc:72
ns3::EventId::GetContext
uint32_t GetContext() const
Definition
event-id.cc:92
ns3::EventId::GetTs
uint64_t GetTs() const
Definition
event-id.cc:85
ns3::EventId::EventId
EventId()
Default constructor.
Definition
event-id.cc:25
ns3::EventId::m_context
uint32_t m_context
The context.
Definition
event-id.h:146
ns3::EventId::m_eventImpl
Ptr< EventImpl > m_eventImpl
The underlying event implementation.
Definition
event-id.h:144
ns3::EventImpl
A simulation event.
Definition
event-impl.h:35
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
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:274
ns3::Simulator::IsExpired
static bool IsExpired(const EventId &id)
Check if an event has already run or been cancelled.
Definition
simulator.cc:284
ns3::Simulator::Remove
static void Remove(const EventId &id)
Remove an event from the event list.
Definition
simulator.cc:264
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:191
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:229
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:443
simulator.h
ns3::Simulator declaration.
src
core
model
event-id.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0