A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
event-id.h
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 #ifndef EVENT_ID_H
21 #define EVENT_ID_H
22 
23 #include <stdint.h>
24 #include "ptr.h"
25 #include "event-impl.h"
26 
27 namespace ns3 {
28 
29 class EventImpl;
30 
46 class EventId {
47 public:
48  EventId ();
49  // internal.
50  EventId (const Ptr<EventImpl> &impl, uint64_t ts, uint32_t context, uint32_t uid);
55  void Cancel (void);
61  bool IsExpired (void) const;
67  bool IsRunning (void) const;
68 public:
69  /* The following methods are semi-private
70  * they are supposed to be invoked only by
71  * subclasses of the Scheduler base class.
72  */
73  EventImpl *PeekEventImpl (void) const;
74  uint64_t GetTs (void) const;
75  uint32_t GetContext (void) const;
76  uint32_t GetUid (void) const;
77 private:
78  friend bool operator == (const EventId &a, const EventId &b);
80  uint64_t m_ts;
81  uint32_t m_context;
82  uint32_t m_uid;
83 };
84 
85 bool operator == (const EventId &a, const EventId &b);
86 bool operator != (const EventId &a, const EventId &b);
87 
88 } // namespace ns3
89 
90 #endif /* EVENT_ID_H */
uint32_t m_uid
Definition: event-id.h:82
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
uint64_t m_ts
Definition: event-id.h:80
bool IsRunning(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
Definition: event-id.cc:59
EventImpl * PeekEventImpl(void) const
Definition: event-id.cc:65
uint32_t GetUid(void) const
Definition: event-id.cc:83
Ptr< EventImpl > m_eventImpl
Definition: event-id.h:79
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
a simulation event
Definition: event-impl.h:39
an identifier for simulation events.
Definition: event-id.h:46
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.cc:89
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
Definition: event-id.cc:47
uint32_t GetContext(void) const
Definition: event-id.cc:77
friend bool operator==(const EventId &a, const EventId &b)
Definition: event-id.cc:89
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
Definition: event-id.cc:53
uint64_t GetTs(void) const
Definition: event-id.cc:71
uint32_t m_context
Definition: event-id.h:81