A Discrete-Event Network Simulator
API
Public Member Functions | Private Attributes | Friends | List of all members
ns3::EventId Class Reference

An identifier for simulation events. More...

#include "event-id.h"

Public Member Functions

 EventId ()
 Default constructor. More...
 
 EventId (const Ptr< EventImpl > &impl, uint64_t ts, uint32_t context, uint32_t uid)
 Construct a real event. More...
 
void Cancel (void)
 This method is syntactic sugar for the ns3::Simulator::Cancel method. More...
 
bool IsExpired (void) const
 This method is syntactic sugar for the ns3::Simulator::IsExpired method. More...
 
bool IsRunning (void) const
 This method is syntactic sugar for !IsExpired(). More...
 
Scheduler Helpers.

These methods are normally invoked only by subclasses of the Scheduler base class.

EventImplPeekEventImpl (void) const
 
uint64_t GetTs (void) const
 
uint32_t GetContext (void) const
 
uint32_t GetUid (void) const
 

Private Attributes

uint32_t m_context
 The context. More...
 
Ptr< EventImplm_eventImpl
 The underlying event implementation. More...
 
uint64_t m_ts
 The virtual time stamp. More...
 
uint32_t m_uid
 The unique id. More...
 

Friends

bool operator!= (const EventId &a, const EventId &b)
 Test if two EventId's are not equal. More...
 
bool operator< (const EventId &a, const EventId &b)
 Less than operator for two EventId's, based on time stamps. More...
 
bool operator== (const EventId &a, const EventId &b)
 Test if two EventId's are equal. More...
 

Detailed Description

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 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(), IsRunning(), IsExpired() or passing around instances of this object will not result in crashes or memory leaks.

Definition at line 53 of file event-id.h.

Constructor & Destructor Documentation

◆ EventId() [1/2]

ns3::EventId::EventId ( )

Default constructor.

This EventId does nothing.

Definition at line 35 of file event-id.cc.

References NS_LOG_FUNCTION.

◆ EventId() [2/2]

ns3::EventId::EventId ( const Ptr< EventImpl > &  impl,
uint64_t  ts,
uint32_t  context,
uint32_t  uid 
)

Construct a real event.

Parameters
[in]implThe implementation of this event.
[in]tsThe virtual time stamp this event should occur.
[in]contextThe execution context for this event.
[in]uidThe unique id for this EventId.

Definition at line 44 of file event-id.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ Cancel()

void ns3::EventId::Cancel ( void  )

This method is syntactic sugar for the ns3::Simulator::Cancel method.

Definition at line 53 of file event-id.cc.

References ns3::Simulator::Cancel(), and NS_LOG_FUNCTION.

Referenced by ns3::WifiPhy::AbortCurrentReception(), ns3::HalfDuplexIdealPhy::AbortRx(), ns3::DefaultChannelScheduler::AssignContinuousAccess(), ns3::DefaultChannelScheduler::AssignExtendedAccess(), ns3::RandomDirection2dMobilityModel::BeginPause(), ns3::RandomWaypointMobilityModel::BeginWalk(), ns3::LrWpanCsmaCa::Cancel(), ns3::MacLow::CancelAllEvents(), ns3::TcpSocketBase::CancelAllTimers(), ns3::LrWpanPhy::CancelEd(), ns3::WifiRadioEnergyModel::ChangeState(), ns3::UanTransducerHd::Clear(), ns3::UanMacCw::Clear(), ns3::UanMacRc::Clear(), ns3::dot11s::PeerLink::ClearConfirmTimer(), ns3::dot11s::PeerLink::ClearHoldingTimer(), ns3::dot11s::PeerLink::ClearRetryTimer(), ns3::WifiPhy::DoChannelSwitch(), ns3::LteRlcTm::DoDispose(), ns3::LteRlcUm::DoDispose(), ns3::LteRlcAm::DoDispose(), ns3::dot11s::PeerLink::DoDispose(), ns3::DefaultChannelScheduler::DoDispose(), ns3::dot11s::HwmpProtocol::DoDispose(), ns3::WaveformGenerator::DoDispose(), ns3::SimpleNetDevice::DoDispose(), ns3::Application::DoDispose(), ns3::MeshWifiInterfaceMac::DoDispose(), ns3::Rip::DoDispose(), ns3::RipNg::DoDispose(), ns3::ApWifiMac::DoDispose(), ns3::LrWpanPhy::DoDispose(), ns3::MacLow::DoDispose(), ns3::TcpSocketBase::DoForwardUp(), ns3::WifiPhy::DoFrequencySwitch(), ns3::MeshWifiInterfaceMac::DoInitialize(), ns3::ApWifiMac::DoInitialize(), ns3::LteRlcTm::DoNotifyTxOpportunity(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::LteRlcUm::DoReceivePdu(), ns3::LteRlcAm::DoReceivePdu(), ns3::LteUeRrc::DoRecvRrcConnectionReject(), ns3::LteUeRrc::DoRecvRrcConnectionSetup(), ns3::LteUeMac::DoReset(), ns3::LteUePhy::DoReset(), ns3::ChannelAccessManager::DoRestartAccessTimeoutIfNeeded(), SimulatorEventsTestCase::DoRun(), ns3::RandomDirection2dMobilityModel::DoSetPosition(), ns3::LteRlcTm::DoTransmitPdcpPdu(), ns3::LteRlcUm::DoTransmitPdcpPdu(), ns3::LteRlcAm::DoTransmitPdcpPdu(), ns3::RandomWalk2dMobilityModel::DoWalk(), ns3::ArpCache::Flush(), ns3::WifiRadioEnergyModel::HandleEnergyChanged(), ns3::TcpSocketBase::LastAckTimeout(), ns3::StaWifiMac::MissedBeacons(), ns3::TcpSocketBase::NewAck(), TcpNewRenoCongAvoidNormalTest::NormalClose(), ns3::WifiRadioEnergyModelPhyListener::NotifyMaybeCcaBusyStart(), ns3::WifiRadioEnergyModelPhyListener::NotifyOff(), ns3::ChannelAccessManager::NotifyOffNow(), ns3::MacLow::NotifyOffNow(), ns3::WifiRadioEnergyModelPhyListener::NotifyRxStart(), ns3::WifiRadioEnergyModelPhyListener::NotifySleep(), ns3::ChannelAccessManager::NotifySleepNow(), ns3::MacLow::NotifySleepNow(), ns3::WifiRadioEnergyModelPhyListener::NotifySwitchingStart(), ns3::ChannelAccessManager::NotifySwitchingStartNow(), ns3::MacLow::NotifySwitchingStartNow(), ns3::WifiRadioEnergyModelPhyListener::NotifyTxStart(), ns3::LrWpanMac::PdDataConfirm(), ns3::LrWpanMac::PdDataIndication(), ns3::TcpWestwood::PktsAcked(), ns3::LrWpanPhy::PlmeSetAttributeRequest(), ns3::LrWpanPhy::PlmeSetTRXStateRequest(), ns3::TcpSocketBase::ProcessSynRcvd(), ns3::TcpSocketBase::ProcessSynSent(), ns3::StaWifiMac::Receive(), ns3::TcpSocketBase::ReceivedData(), ns3::MacLow::ReceiveOk(), ns3::LteUeMac::RecvRaResponse(), ns3::UeManager::RecvRrcConnectionReconfigurationCompleted(), ns3::UeManager::RecvRrcConnectionReestablishmentRequest(), ns3::UeManager::RecvRrcConnectionRequest(), ns3::UeManager::RecvRrcConnectionSetupCompleted(), ns3::UeManager::RecvUeContextRelease(), ns3::DefaultChannelScheduler::ReleaseAccess(), ns3::RadioBearerStatsCalculator::RescheduleEndEpoch(), ns3::LteSpectrumPhy::Reset(), ns3::MacLow::ResetBlockAckInactivityTimerIfNeeded(), ns3::UanMacRc::ScheduleData(), ns3::StaWifiMac::SendAssociationRequest(), ns3::TcpSocketCongestedRouter::SendDataPacket(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), ns3::TcpSocketBase::SendEmptyPacket(), ns3::WifiPhy::SendPacket(), ns3::Rip::SendUnsolicitedRouteUpdate(), ns3::RipNg::SendUnsolicitedRouteUpdate(), ns3::ApWifiMac::SetBeaconGeneration(), ns3::dot11s::PeerLink::SetBeaconInformation(), ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed(), ns3::WifiRadioEnergyModel::SetEnergySource(), ns3::WifiPhy::SetOffMode(), ns3::StaWifiMac::StartScanning(), ns3::LteTestRrc::Stop(), ns3::WaveformGenerator::Stop(), ns3::V4Ping::StopApplication(), ns3::ChannelCoordinator::StopChannelCoordination(), ns3::dot11s::HwmpProtocol::UnsetRoot(), ns3::BasicEnergySource::UpdateEnergySource(), ns3::RvBatteryModel::UpdateEnergySource(), ns3::LiIonEnergySource::UpdateEnergySource(), ns3::BasicEnergyHarvester::UpdateHarvestedPower(), ns3::BlockAckAgreement::~BlockAckAgreement(), and ns3::Timer::~Timer().

◆ GetContext()

uint32_t ns3::EventId::GetContext ( void  ) const
Returns
The event context.

Definition at line 83 of file event-id.cc.

References m_context, and NS_LOG_FUNCTION.

◆ GetTs()

uint64_t ns3::EventId::GetTs ( void  ) const
Returns
The virtual time stamp.

Definition at line 77 of file event-id.cc.

References m_ts, and NS_LOG_FUNCTION.

Referenced by ns3::operator<().

◆ GetUid()

uint32_t ns3::EventId::GetUid ( void  ) const
Returns
The unique id.

Definition at line 89 of file event-id.cc.

References m_uid, and NS_LOG_FUNCTION.

Referenced by ns3::dsdv::RoutingProtocol::RecvDsdv().

◆ IsExpired()

bool ns3::EventId::IsExpired ( void  ) const

This method is syntactic sugar for the ns3::Simulator::IsExpired method.

Returns
true if the event has expired, false otherwise.

Definition at line 59 of file event-id.cc.

References ns3::Simulator::IsExpired(), and NS_LOG_FUNCTION.

Referenced by ns3::DefaultChannelScheduler::AssignContinuousAccess(), ns3::DefaultChannelScheduler::AssignExtendedAccess(), ns3::LrWpanPhy::CancelEd(), ns3::dsdv::RoutingTable::DeleteIpv4Event(), SimulatorEventsTestCase::destroy(), ns3::TbfQueueDisc::DoDequeue(), ns3::DefaultChannelScheduler::DoDispose(), ns3::TcpSocketBase::DoForwardUp(), ns3::ChannelAccessManager::DoRestartAccessTimeoutIfNeeded(), SimulatorEventsTestCase::DoRun(), ns3::LrWpanPhy::EndRx(), ns3::Timer::IsExpired(), IsRunning(), ns3::LrWpanMac::PdDataConfirm(), ns3::LrWpanPhy::PlmeSetTRXStateRequest(), ns3::TcpSocketBase::ReceivedData(), ns3::MacLow::ReceiveOk(), ns3::DefaultChannelScheduler::ReleaseAccess(), ns3::StaWifiMac::RestartBeaconWatchdog(), ns3::UdpClient::Send(), ns3::PacketSocketClient::Send(), EpsBearerTagUdpClient::Send(), ns3::Ping6::Send(), ns3::UdpTraceClient::Send(), ns3::UdpEchoClient::Send(), ns3::MacLow::SendCtsToSelf(), ns3::TcpSocketCongestedRouter::SendDataPacket(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), ns3::TcpSocketBase::SendEmptyPacket(), ns3::OnOffApplication::SendPacket(), ns3::MacLow::SendRtsForPacket(), ns3::MacLow::StartDataTxTimers(), ns3::WifiPhy::StartReceivePacket(), ns3::LrWpanPhy::StartRx(), ns3::WifiPhy::StartRx(), and ns3::ChannelCoordinator::StopChannelCoordination().

◆ IsRunning()

bool ns3::EventId::IsRunning ( void  ) const

This method is syntactic sugar for !IsExpired().

Returns
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::WifiPhy::AbortCurrentReception(), ns3::dsdv::RoutingTable::AnyRunningEvent(), ns3::UanMacRc::Associate(), ns3::UanMacRc::AssociateTimeout(), ns3::MacLow::CancelAllEvents(), ns3::OnOffApplication::CancelEvents(), ns3::LrWpanMac::CheckQueue(), TcpNewRenoCongAvoidNormalTest::CWndTrace(), ns3::MacLow::DeaggregateAmpduAndReceive(), ns3::dsdv::RoutingTable::DeleteIpv4Event(), ns3::V4Ping::DoDispose(), ns3::WaveformGenerator::DoDispose(), ns3::SimpleNetDevice::DoDispose(), ns3::ArpCache::DoDispose(), ns3::TcpSocketBase::DoForwardUp(), ns3::MeshWifiInterfaceMac::DoInitialize(), ns3::SteadyStateRandomWaypointMobilityModel::DoInitializePrivate(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::SubscriberStationNetDevice::DoReceive(), ns3::LteRlcUm::DoReceivePdu(), ns3::LteRlcAm::DoReceivePdu(), ns3::LteRlcAm::DoReportBufferStatus(), ns3::ChannelAccessManager::DoRestartAccessTimeoutIfNeeded(), ns3::LrWpanPhy::EndRx(), ns3::LrWpanPhy::EndTx(), ns3::UanPhyGen::EnergyDepletionHandler(), ns3::UanMacCw::Enqueue(), ns3::UanMacRc::Enqueue(), ns3::ArpCache::Flush(), ns3::MeshWifiInterfaceMac::GetBeaconGeneration(), ns3::Timer::IsRunning(), ns3::StaWifiMac::MissedBeacons(), ns3::ChannelAccessManager::NotifyOffNow(), ns3::MacLow::NotifyOffNow(), ns3::ChannelAccessManager::NotifySleepNow(), ns3::MacLow::NotifySleepNow(), ns3::ChannelAccessManager::NotifySwitchingStartNow(), ns3::MacLow::NotifySwitchingStartNow(), ns3::UanMacCw::NotifyTxStart(), ns3::LrWpanPhy::PdDataRequest(), ns3::SSLinkManager::PerformRanging(), ns3::Watchdog::Ping(), TcpZeroWindowTest::ProcessedAck(), ns3::StaWifiMac::Receive(), ns3::MacLow::ReceiveOk(), ns3::MacLow::ResetBlockAckInactivityTimerIfNeeded(), ns3::UanMacRc::RtsTimeout(), ns3::Timer::Schedule(), ns3::UanMacRc::ScheduleData(), ns3::SsServiceFlowManager::ScheduleDsaReq(), ns3::BsServiceFlowManager::ScheduleDsaRsp(), ns3::TcpSocketBase::Send(), ns3::StaWifiMac::SendAssociationRequest(), ns3::MeshWifiInterfaceMac::SendBeacon(), ns3::SimpleNetDevice::SendFrom(), ns3::dot11s::HwmpProtocolMac::SendMyPerr(), ns3::dot11s::HwmpProtocolMac::SendMyPreq(), ns3::UanMacRc::SendRts(), ns3::Rip::SendTriggeredRouteUpdate(), ns3::RipNg::SendTriggeredRouteUpdate(), ns3::Rip::SendUnsolicitedRouteUpdate(), ns3::RipNg::SendUnsolicitedRouteUpdate(), ns3::FdReader::Start(), ns3::WaveformGenerator::Start(), ns3::LrWpanPhy::StartRx(), ns3::StaWifiMac::StartScanning(), ns3::ArpCache::StartWaitReplyTimer(), ns3::WaveformGenerator::Stop(), MyApp::StopApplication(), ns3::V4Ping::StopApplication(), SimpleSource::StopApplication(), and ns3::Timer::~Timer().

◆ PeekEventImpl()

EventImpl * ns3::EventId::PeekEventImpl ( void  ) const
Returns
The underlying EventImpl pointer.

Definition at line 71 of file event-id.cc.

References m_eventImpl, NS_LOG_FUNCTION, and ns3::PeekPointer().

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const EventId a,
const EventId b 
)
friend

Test if two EventId's are not equal.

Parameters
[in]aThe first EventId.
[in]bThe second EventId.
Returns
true if the a and b are not the same event.

Definition at line 146 of file event-id.h.

◆ operator<

bool operator< ( const EventId a,
const EventId b 
)
friend

Less than operator for two EventId's, based on time stamps.

Parameters
[in]aThe first EventId.
[in]bThe second EventId.
Returns
true if a occurs before b.

Definition at line 153 of file event-id.h.

◆ operator==

bool operator== ( const EventId a,
const EventId b 
)
friend

Test if two EventId's are equal.

Parameters
[in]aThe first EventId.
[in]bThe second EventId.
Returns
true if the a and b represent the same event.

Definition at line 135 of file event-id.h.

Member Data Documentation

◆ m_context

uint32_t ns3::EventId::m_context
private

The context.

Definition at line 125 of file event-id.h.

Referenced by GetContext(), and ns3::operator==().

◆ m_eventImpl

Ptr<EventImpl> ns3::EventId::m_eventImpl
private

The underlying event implementation.

Definition at line 123 of file event-id.h.

Referenced by ns3::operator==(), and PeekEventImpl().

◆ m_ts

uint64_t ns3::EventId::m_ts
private

The virtual time stamp.

Definition at line 124 of file event-id.h.

Referenced by GetTs(), and ns3::operator==().

◆ m_uid

uint32_t ns3::EventId::m_uid
private

The unique id.

Definition at line 126 of file event-id.h.

Referenced by GetUid(), and ns3::operator==().


The documentation for this class was generated from the following files: