An identifier for simulation events. More...
#include "event-id.h"
Public Types | |
enum | UID { INVALID = 0 , NOW = 1 , DESTROY = 2 , RESERVED = 3 , VALID = 4 } |
Special values of the event UID. More... | |
Public Member Functions | |
EventId () | |
Default constructor. | |
EventId (const Ptr< EventImpl > &impl, uint64_t ts, uint32_t context, uint32_t uid) | |
Construct a real event. | |
void | Cancel () |
This method is syntactic sugar for the ns3::Simulator::Cancel method. | |
bool | IsExpired () const |
This method is syntactic sugar for the ns3::Simulator::IsExpired method. | |
bool | IsPending () const |
This method is syntactic sugar for !IsExpired(). | |
bool | IsRunning () const |
This method is syntactic sugar for !IsExpired(). | |
void | Remove () |
This method is syntactic sugar for the ns3::Simulator::Remove method. | |
Scheduler Helpers. | |
These methods are normally invoked only by subclasses of the Scheduler base class. | |
EventImpl * | PeekEventImpl () const |
uint64_t | GetTs () const |
uint32_t | GetContext () const |
uint32_t | GetUid () const |
Private Attributes | |
uint32_t | m_context |
The context. | |
Ptr< EventImpl > | m_eventImpl |
The underlying event implementation. | |
uint64_t | m_ts |
The virtual time stamp. | |
uint32_t | m_uid |
The unique id. | |
Friends | |
bool | operator!= (const EventId &a, const EventId &b) |
Test if two EventId's are not equal. | |
bool | operator< (const EventId &a, const EventId &b) |
Less than operator for two EventId's, based on time stamps. | |
bool | operator== (const EventId &a, const EventId &b) |
Test if two EventId's are equal. | |
An identifier for simulation events.
Each EventId identifies a unique event scheduled with one of the many Simulator::Schedule() methods. This EventId can be used to cancel or remove events after they are scheduled with Cancel(), Remove(), or Simulator::Cancel() or Simulator::Remove().
The important thing to remember about this class is that every variable of this type is always in a valid state, even when it has not been assigned an EventId coming from a Simulator::Schedule() method: calling Simulator::Cancel(), IsPending(), IsExpired() or passing around instances of this object will not result in crashes or memory leaks.
Definition at line 44 of file event-id.h.
enum ns3::EventId::UID |
Special values of the event UID.
Enumerator | |
---|---|
INVALID | Invalid UID value. |
NOW | ScheduleNow() events. |
DESTROY | ScheduleDestroy() events. |
RESERVED | Reserved UID. |
VALID | Schedule(), etc. events. |
Definition at line 48 of file event-id.h.
ns3::EventId::EventId | ( | ) |
Default constructor.
This EventId does nothing.
Definition at line 25 of file event-id.cc.
References m_context, m_eventImpl, m_ts, m_uid, and NS_LOG_FUNCTION.
Referenced by operator!=, operator<, and operator==.
ns3::EventId::EventId | ( | const Ptr< EventImpl > & | impl, |
uint64_t | ts, | ||
uint32_t | context, | ||
uint32_t | uid ) |
Construct a real event.
[in] | impl | The implementation of this event. |
[in] | ts | The virtual time stamp this event should occur. |
[in] | context | The execution context for this event. |
[in] | uid | The unique id for this EventId. |
Definition at line 34 of file event-id.cc.
References m_context, m_eventImpl, m_ts, m_uid, and NS_LOG_FUNCTION.
void ns3::EventId::Cancel | ( | ) |
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition at line 44 of file event-id.cc.
References ns3::Simulator::Cancel(), and NS_LOG_FUNCTION.
Referenced by ns3::ApWifiMac::DoInitialize(), and ns3::ApWifiMac::SetBeaconGeneration().
uint32_t ns3::EventId::GetContext | ( | ) | const |
Definition at line 92 of file event-id.cc.
References m_context, and NS_LOG_FUNCTION.
uint64_t ns3::EventId::GetTs | ( | ) | const |
Definition at line 85 of file event-id.cc.
References m_ts, and NS_LOG_FUNCTION.
Referenced by operator<, and ns3::Time::operator<.
uint32_t ns3::EventId::GetUid | ( | ) | const |
Definition at line 99 of file event-id.cc.
References m_uid, and NS_LOG_FUNCTION.
Referenced by ns3::dsdv::RoutingProtocol::RecvDsdv().
bool ns3::EventId::IsExpired | ( | ) | const |
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
true
if the event has expired, false
otherwise. Definition at line 58 of file event-id.cc.
References ns3::Simulator::IsExpired(), and NS_LOG_FUNCTION.
Referenced by ns3::dsdv::RoutingTable::DeleteIpv4Event(), SimulatorEventsTestCase::DoRun(), and IsPending().
bool ns3::EventId::IsPending | ( | ) | const |
This method is syntactic sugar for !IsExpired().
true
if the event has not expired, false
otherwise. Definition at line 65 of file event-id.cc.
References IsExpired(), and NS_LOG_FUNCTION.
Referenced by ns3::dsdv::RoutingTable::DeleteIpv4Event(), IsRunning(), TcpZeroWindowTest::ProcessedAck(), and ns3::Txop::Queue().
bool ns3::EventId::IsRunning | ( | ) | const |
This method is syntactic sugar for !IsExpired().
true
if the event has not expired, false
otherwise. Definition at line 72 of file event-id.cc.
References IsPending().
EventImpl * ns3::EventId::PeekEventImpl | ( | ) | const |
Definition at line 78 of file event-id.cc.
References m_eventImpl, NS_LOG_FUNCTION, and ns3::PeekPointer().
void ns3::EventId::Remove | ( | ) |
This method is syntactic sugar for the ns3::Simulator::Remove method.
Definition at line 51 of file event-id.cc.
References NS_LOG_FUNCTION, and ns3::Simulator::Remove().
|
private |
The context.
Definition at line 146 of file event-id.h.
Referenced by EventId(), EventId(), and GetContext().
The underlying event implementation.
Definition at line 144 of file event-id.h.
Referenced by EventId(), EventId(), and PeekEventImpl().
|
private |
The virtual time stamp.
Definition at line 145 of file event-id.h.
|
private |
The unique id.
Definition at line 147 of file event-id.h.