|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
36 : m_flags (CHECK_ON_DESTROY),
45 : m_flags (destroyPolicy),
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
State
The possible states of the Timer.
EventId m_event
The future event scheduled to expire the timer.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual EventId Schedule(const Time &delay)=0
Schedule the callback for a future time.
@ EXPIRED
Timer has already expired.
int m_flags
Bitfield for Timer State, DestroyPolicy and InternalSuspended.
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
@ SUSPENDED
Timer is suspended.
@ CHECK_ON_DESTROY
This policy enforces a check from the destructor of the Timer to verify that the timer has already ex...
enum Timer::State GetState(void) const
Time FemtoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time m_delay
The delay configured for this Timer.
void Cancel(void)
Cancel the currently-running event if there is one.
Time GetDelayLeft(void) const
bool IsRunning(void) const
void Remove(void)
Remove from the simulation event-list the currently-running event if there is one.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
void Resume(void)
Restart the timer to expire within the amount of time left saved during Suspend.
void Schedule(void)
Schedule a new event using the currently-configured delay, function, and arguments.
ns3::Timer class declaration.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
@ RUNNING
Timer is currently running.
Simulation virtual time values and global simulation resolution.
@ CANCEL_ON_DESTROY
This policy cancels the event from the destructor of the Timer or from Suspend().
void Remove(void)
This method is syntactic sugar for the ns3::Simulator::Remove method.
Timer()
Create a timer with a default event lifetime management policy:
@ REMOVE_ON_DESTROY
This policy removes the event from the simulation event list when the destructor of the Timer is invo...
ns3::SimulationSingleton declaration and template implementation.
void SetDelay(const Time &delay)
bool IsSuspended(void) const
ns3::Simulator declaration.
bool IsExpired(void) const
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
TimerImpl * m_impl
The timer implementation, which contains the bound callback function and arguments.
void Suspend(void)
Pause the timer and save the amount of time left until it was set to expire.
DestroyPolicy
The policy to use to manager the internal timer when an instance of the Timer class is destroyed or s...
Time GetDelay(void) const
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Time m_delayLeft
The amount of time left on the Timer while it is suspended.