A Discrete-Event Network Simulator
API
 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 
24 namespace ns3 {
25 
27  : m_eventImpl (0),
28  m_ts (0),
29  m_context (0),
30  m_uid (0)
31 {
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 }
41 void
43 {
44  Simulator::Cancel (*this);
45 }
46 bool
47 EventId::IsExpired (void) const
48 {
49  return Simulator::IsExpired (*this);
50 }
51 bool
52 EventId::IsRunning (void) const
53 {
54  return !IsExpired ();
55 }
56 EventImpl *
58 {
59  return PeekPointer (m_eventImpl);
60 }
61 uint64_t
62 EventId::GetTs (void) const
63 {
64  return m_ts;
65 }
66 uint32_t
67 EventId::GetContext (void) const
68 {
69  return m_context;
70 }
71 uint32_t
72 EventId::GetUid (void) const
73 {
74  return m_uid;
75 }
76 
77 bool operator == (const EventId &a, const EventId &b)
78 {
79  return
80  a.m_uid == b.m_uid &&
81  a.m_context == b.m_context &&
82  a.m_ts == b.m_ts &&
83  a.m_eventImpl == b.m_eventImpl;
84 }
85 bool operator != (const EventId &a, const EventId &b)
86 {
87  return !(a == b);
88 }
89 
90 
91 
92 } // namespace ns3