A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
core
model
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
bool
59
EventId::IsExpired
(
void
)
const
60
{
61
NS_LOG_FUNCTION
(
this
);
62
return
Simulator::IsExpired
(*
this
);
63
}
64
bool
65
EventId::IsRunning
(
void
)
const
66
{
67
NS_LOG_FUNCTION
(
this
);
68
return
!
IsExpired
();
69
}
70
EventImpl
*
71
EventId::PeekEventImpl
(
void
)
const
72
{
73
NS_LOG_FUNCTION
(
this
);
74
return
PeekPointer
(
m_eventImpl
);
75
}
76
uint64_t
77
EventId::GetTs
(
void
)
const
78
{
79
NS_LOG_FUNCTION
(
this
);
80
return
m_ts
;
81
}
82
uint32_t
83
EventId::GetContext
(
void
)
const
84
{
85
NS_LOG_FUNCTION
(
this
);
86
return
m_context
;
87
}
88
uint32_t
89
EventId::GetUid
(
void
)
const
90
{
91
NS_LOG_FUNCTION
(
this
);
92
return
m_uid
;
93
}
94
95
96
}
// namespace ns3
ns3::EventId::m_uid
uint32_t m_uid
The unique id.
Definition:
event-id.h:126
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:73
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:213
event-impl.h
ns3::EventImpl declarations.
ns3::EventId::m_ts
uint64_t m_ts
The virtual time stamp.
Definition:
event-id.h:124
ns3::PeekPointer
U * PeekPointer(const Ptr< U > &p)
Definition:
ptr.h:564
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
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:346
simulator.h
ns3::Simulator declaration.
ns3::EventId::PeekEventImpl
EventImpl * PeekEventImpl(void) const
Definition:
event-id.cc:71
ns3::EventId::IsExpired
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition:
event-id.cc:59
ns3::EventId::EventId
EventId()
Default constructor.
Definition:
event-id.cc:35
ns3::EventId::m_eventImpl
Ptr< EventImpl > m_eventImpl
The underlying event implementation.
Definition:
event-id.h:123
ns3::EventId::GetTs
uint64_t GetTs(void) const
Definition:
event-id.cc:77
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Simulator::IsExpired
static bool IsExpired(const EventId &id)
Check if an event has already run or been cancelled.
Definition:
simulator.cc:356
ns3::EventId::GetUid
uint32_t GetUid(void) const
Definition:
event-id.cc:89
ns3::EventId::GetContext
uint32_t GetContext(void) const
Definition:
event-id.cc:83
ns3::EventImpl
A simulation event.
Definition:
event-impl.h:44
ns3::EventId::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition:
event-id.cc:65
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition:
event-id.cc:53
log.h
Debug message logging.
event-id.h
ns3::EventId declarations.
ns3::EventId::m_context
uint32_t m_context
The context.
Definition:
event-id.h:125
Generated on Wed Nov 7 2018 10:01:49 for ns-3 by
1.8.14