A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
25
NS_LOG_COMPONENT_DEFINE
(
"EventId"
);
26
27
namespace
ns3 {
28
29
EventId::EventId
()
30
: m_eventImpl (0),
31
m_ts (0),
32
m_context (0),
33
m_uid (0)
34
{
35
NS_LOG_FUNCTION
(
this
);
36
}
37
38
EventId::EventId
(
const
Ptr<EventImpl>
&impl, uint64_t ts, uint32_t context, uint32_t uid)
39
: m_eventImpl (impl),
40
m_ts (ts),
41
m_context (context),
42
m_uid (uid)
43
{
44
NS_LOG_FUNCTION
(
this
<< impl << ts << context << uid);
45
}
46
void
47
EventId::Cancel
(
void
)
48
{
49
NS_LOG_FUNCTION
(
this
);
50
Simulator::Cancel
(*
this
);
51
}
52
bool
53
EventId::IsExpired
(
void
)
const
54
{
55
NS_LOG_FUNCTION
(
this
);
56
return
Simulator::IsExpired
(*
this
);
57
}
58
bool
59
EventId::IsRunning
(
void
)
const
60
{
61
NS_LOG_FUNCTION
(
this
);
62
return
!
IsExpired
();
63
}
64
EventImpl
*
65
EventId::PeekEventImpl
(
void
)
const
66
{
67
NS_LOG_FUNCTION
(
this
);
68
return
PeekPointer
(
m_eventImpl
);
69
}
70
uint64_t
71
EventId::GetTs
(
void
)
const
72
{
73
NS_LOG_FUNCTION
(
this
);
74
return
m_ts
;
75
}
76
uint32_t
77
EventId::GetContext
(
void
)
const
78
{
79
NS_LOG_FUNCTION
(
this
);
80
return
m_context
;
81
}
82
uint32_t
83
EventId::GetUid
(
void
)
const
84
{
85
NS_LOG_FUNCTION
(
this
);
86
return
m_uid
;
87
}
88
89
bool
operator ==
(
const
EventId
&a,
const
EventId
&b)
90
{
91
return
92
a.
m_uid
== b.
m_uid
&&
93
a.
m_context
== b.
m_context
&&
94
a.
m_ts
== b.
m_ts
&&
95
a.
m_eventImpl
== b.
m_eventImpl
;
96
}
97
bool
operator !=
(
const
EventId
&a,
const
EventId
&b)
98
{
99
return
!(a == b);
100
}
101
102
103
104
}
// namespace ns3
ns3::EventId::m_uid
uint32_t m_uid
Definition:
event-id.h:82
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
event-impl.h
ns3::EventId::m_ts
uint64_t m_ts
Definition:
event-id.h:80
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::EventId::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
Definition:
event-id.cc:59
simulator.h
ns3::EventId::PeekEventImpl
EventImpl * PeekEventImpl(void) const
Definition:
event-id.cc:65
ns3::EventId::EventId
EventId()
Definition:
event-id.cc:29
ns3::PeekPointer
T * PeekPointer(const Ptr< T > &p)
Definition:
ptr.h:279
ns3::EventId::GetUid
uint32_t GetUid(void) const
Definition:
event-id.cc:83
ns3::EventId::m_eventImpl
Ptr< EventImpl > m_eventImpl
Definition:
event-id.h:79
ns3::operator!=
bool operator!=(Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > a, Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > b)
Inequality test.
Definition:
callback.h:1213
ns3::Simulator::IsExpired
static bool IsExpired(const EventId &id)
This method has O(1) complexity.
Definition:
simulator.cc:278
ns3::EventImpl
a simulation event
Definition:
event-impl.h:39
ns3::EventId
an identifier for simulation events.
Definition:
event-id.h:46
ns3::operator==
bool operator==(const EventId &a, const EventId &b)
Definition:
event-id.cc:89
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
Definition:
event-id.cc:47
ns3::EventId::GetContext
uint32_t GetContext(void) const
Definition:
event-id.cc:77
log.h
ns3::EventId::IsExpired
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
Definition:
event-id.cc:53
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("EventId")
event-id.h
ns3::EventId::GetTs
uint64_t GetTs(void) const
Definition:
event-id.cc:71
ns3::EventId::m_context
uint32_t m_context
Definition:
event-id.h:81
src
core
model
event-id.cc
Generated on Sat Apr 19 2014 14:06:51 for ns-3 by
1.8.6