133 template <
typename FN>
145 template <
typename MEM_PTR,
typename OBJ_PTR>
154 template <
typename... Ts>
273template <
typename FN>
281template <
typename MEM_PTR,
typename OBJ_PTR>
289template <
typename... Ts>
295 NS_FATAL_ERROR(
"You cannot set the arguments of a Timer before setting its function.");
An identifier for simulation events.
Simulation virtual time values and global simulation resolution.
A simple virtual Timer class.
void SetDelay(const Time &delay)
TimerImpl * m_impl
The timer implementation, which contains the bound callback function and arguments.
Timer()
Create a timer with a default event lifetime management policy:
EventId m_event
The future event scheduled to expire the timer.
Time GetDelayLeft() const
Timer::State GetState() const
void SetArguments(Ts... args)
int m_flags
Bitfield for Timer State, DestroyPolicy and InternalSuspended.
DestroyPolicy
The policy to use to manager the internal timer when an instance of the Timer class is destroyed or s...
@ CANCEL_ON_DESTROY
This policy cancels the event from the destructor of the Timer or from Suspend().
@ CHECK_ON_DESTROY
This policy enforces a check from the destructor of the Timer to verify that the timer has already ex...
@ REMOVE_ON_DESTROY
This policy removes the event from the simulation event list when the destructor of the Timer is invo...
State
The possible states of the Timer.
@ RUNNING
Timer is currently running.
@ EXPIRED
Timer has already expired.
@ SUSPENDED
Timer is suspended.
static constexpr auto TIMER_SUSPENDED
Internal bit marking the suspended timer state.
void Cancel()
Cancel the currently-running event if there is one.
Time m_delay
The delay configured for this Timer.
void Remove()
Remove from the simulation event-list the currently-running event if there is one.
void Schedule()
Schedule a new event using the currently-configured delay, function, and arguments.
Time m_delayLeft
The amount of time left on the Timer while it is suspended.
void Resume()
Restart the timer to expire within the amount of time left saved during Suspend.
void Suspend()
Pause the timer and save the amount of time left until it was set to expire.
The timer implementation underlying Timer and Watchdog.
void SetArgs(T1 a1)
Set the arguments to be used when invoking the expire function.
ns3::EventId declarations.
NS_FATAL_x macro definitions.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
TimerImpl * MakeTimerImpl(FN fn)
Make a TimerImpl from a function pointer taking varying numbers of arguments.
ns3::IntToType template class.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of classes ns3::Time and ns3::TimeWithUnit, and the TimeValue implementation classes.
ns3::TimerImpl declaration and implementation.