A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
event-id.cc
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
#include "
event-id.h
"
21
#include "
simulator.h
"
22
#include "
event-impl.h
"
23
#include "
log.h
"
24
31
namespace
ns3
{
32
33
NS_LOG_COMPONENT_DEFINE
(
"EventId"
);
34
35
EventId::EventId
()
36
: m_eventImpl (0),
37
m_ts (0),
38
m_context (0),
39
m_uid (0)
40
{
41
NS_LOG_FUNCTION
(
this
);
42
}
43
44
EventId::EventId
(
const
Ptr<EventImpl>
&impl, uint64_t ts, uint32_t context, uint32_t uid)
45
: m_eventImpl (impl),
46
m_ts (ts),
47
m_context (context),
48
m_uid (uid)
49
{
50
NS_LOG_FUNCTION
(
this
<< impl << ts << context << uid);
51
}
52
void
53
EventId::Cancel
(
void
)
54
{
55
NS_LOG_FUNCTION
(
this
);
56
Simulator::Cancel
(*
this
);
57
}
58
void
59
EventId::Remove
(
void
)
60
{
61
NS_LOG_FUNCTION
(
this
);
62
Simulator::Remove
(*
this
);
63
}
64
bool
65
EventId::IsExpired
(
void
)
const
66
{
67
NS_LOG_FUNCTION
(
this
);
68
return
Simulator::IsExpired
(*
this
);
69
}
70
bool
71
EventId::IsRunning
(
void
)
const
72
{
73
NS_LOG_FUNCTION
(
this
);
74
return
!
IsExpired
();
75
}
76
EventImpl
*
77
EventId::PeekEventImpl
(
void
)
const
78
{
79
NS_LOG_FUNCTION
(
this
);
80
return
PeekPointer
(
m_eventImpl
);
81
}
82
uint64_t
83
EventId::GetTs
(
void
)
const
84
{
85
NS_LOG_FUNCTION
(
this
);
86
return
m_ts
;
87
}
88
uint32_t
89
EventId::GetContext
(
void
)
const
90
{
91
NS_LOG_FUNCTION
(
this
);
92
return
m_context
;
93
}
94
uint32_t
95
EventId::GetUid
(
void
)
const
96
{
97
NS_LOG_FUNCTION
(
this
);
98
return
m_uid
;
99
}
100
101
102
}
// namespace ns3
ns3::EventId::GetContext
uint32_t GetContext(void) const
Definition:
event-id.cc:89
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::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition:
event-id.cc:71
ns3::EventId::PeekEventImpl
EventImpl * PeekEventImpl(void) const
Definition:
event-id.cc:77
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition:
event-id.cc:53
ns3::EventId::GetUid
uint32_t GetUid(void) const
Definition:
event-id.cc:95
ns3::EventId::Remove
void Remove(void)
This method is syntactic sugar for the ns3::Simulator::Remove method.
Definition:
event-id.cc:59
ns3::EventId::IsExpired
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition:
event-id.cc:65
ns3::EventId::GetTs
uint64_t GetTs(void) const
Definition:
event-id.cc:83
ns3::EventId::EventId
EventId()
Default constructor.
Definition:
event-id.cc:35
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:45
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
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:268
ns3::Simulator::IsExpired
static bool IsExpired(const EventId &id)
Check if an event has already run or been cancelled.
Definition:
simulator.cc:278
ns3::Simulator::Remove
static void Remove(const EventId &id)
Remove an event from the event list.
Definition:
simulator.cc:258
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:205
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:244
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:415
simulator.h
ns3::Simulator declaration.
src
core
model
event-id.cc
Generated on Tue Feb 6 2024 19:21:16 for ns-3 by
1.9.1