#include <timer.h>
Public Types | |
enum | DestroyPolicy { CANCEL_ON_DESTROY = (1<<3), REMOVE_ON_DESTROY = (1<<4), CHECK_ON_DESTROY = (1<<5) } |
Public Member Functions | |
Timer () | |
Timer (enum DestroyPolicy destroyPolicy) | |
template<typename FN > | |
void | SetFunction (FN fn) |
template<typename MEM_PTR , typename OBJ_PTR > | |
void | SetFunction (MEM_PTR memPtr, OBJ_PTR objPtr) |
template<typename T1 > | |
void | SetArguments (T1 a1) |
template<typename T1 , typename T2 > | |
void | SetArguments (T1 a1, T2 a2) |
template<typename T1 , typename T2 , typename T3 > | |
void | SetArguments (T1 a1, T2 a2, T3 a3) |
template<typename T1 , typename T2 , typename T3 , typename T4 > | |
void | SetArguments (T1 a1, T2 a2, T3 a3, T4 a4) |
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 > | |
void | SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) |
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 > | |
void | SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) |
void | SetDelay (const Time &delay) |
Time | GetDelay (void) const |
Time | GetDelayLeft (void) const |
void | Cancel (void) |
void | Remove (void) |
bool | IsExpired (void) const |
bool | IsRunning (void) const |
bool | IsSuspended (void) const |
enum Timer::State | GetState (void) const |
void | Schedule (void) |
void | Schedule (Time delay) |
void | Suspend (void) |
void | Resume (void) |
A timer is used to hold together a delay, a function to invoke when the delay expires, and a set of arguments to pass to the function when the delay expires.
A timer can also be used to enforce a set of predefined event lifetime management policies. These policies are specified at construction time and cannot be changed after.
The policy to use to manager the internal timer when and instance of the Timer class is destroyed.
CANCEL_ON_DESTROY | This policy cancels the event from the destructor of the Timer to verify that the event has already expired. |
REMOVE_ON_DESTROY | This policy removes the event from the simulation event list when the destructor of the Timer is invoked. |
CHECK_ON_DESTROY | This policy enforces a check from the destructor of the Timer to verify that the timer has already expired. |
ns3::Timer::Timer | ( | ) |
create a timer with a default event lifetime management policy:
ns3::Timer::Timer | ( | enum DestroyPolicy | destroyPolicy | ) |
destroyPolicy | the event lifetime management policies to use for destroy events |
void ns3::Timer::Cancel | ( | void | ) |
Cancel the currently-running event if there is one. Do nothing otherwise.
Time ns3::Timer::GetDelay | ( | void | ) | const |
Time ns3::Timer::GetDelayLeft | ( | void | ) | const |
enum Timer::State ns3::Timer::GetState | ( | void | ) | const |
bool ns3::Timer::IsExpired | ( | void | ) | const |
bool ns3::Timer::IsRunning | ( | void | ) | const |
bool ns3::Timer::IsSuspended | ( | void | ) | const |
void ns3::Timer::Remove | ( | void | ) |
Remove from the simulation event-list the currently-running event if there is one. Do nothing otherwise.
void ns3::Timer::Resume | ( | void | ) |
Restart the timer to expire within the amount of time left saved during Suspend. Calling Resume without a prior call to Suspend is an error.
void ns3::Timer::Schedule | ( | Time | delay | ) |
delay | the delay to use |
void ns3::Timer::Schedule | ( | void | ) |
Schedule a new event using the currently-configured delay, function, and arguments.
void ns3::Timer::SetArguments | ( | T1 | a1, | |
T2 | a2, | |||
T3 | a3, | |||
T4 | a4, | |||
T5 | a5, | |||
T6 | a6 | |||
) | [inline] |
a1 | the first argument | |
a2 | the second argument | |
a3 | the third argument | |
a4 | the fourth argument | |
a5 | the fifth argument | |
a6 | the sixth argument |
References NS_FATAL_ERROR.
void ns3::Timer::SetArguments | ( | T1 | a1, | |
T2 | a2, | |||
T3 | a3, | |||
T4 | a4, | |||
T5 | a5 | |||
) | [inline] |
a1 | the first argument | |
a2 | the second argument | |
a3 | the third argument | |
a4 | the fourth argument | |
a5 | the fifth argument |
References NS_FATAL_ERROR.
void ns3::Timer::SetArguments | ( | T1 | a1, | |
T2 | a2, | |||
T3 | a3, | |||
T4 | a4 | |||
) | [inline] |
a1 | the first argument | |
a2 | the second argument | |
a3 | the third argument | |
a4 | the fourth argument |
References NS_FATAL_ERROR.
void ns3::Timer::SetArguments | ( | T1 | a1, | |
T2 | a2, | |||
T3 | a3 | |||
) | [inline] |
a1 | the first argument | |
a2 | the second argument | |
a3 | the third argument |
References NS_FATAL_ERROR.
void ns3::Timer::SetArguments | ( | T1 | a1, | |
T2 | a2 | |||
) | [inline] |
a1 | the first argument | |
a2 | the second argument |
References NS_FATAL_ERROR.
void ns3::Timer::SetArguments | ( | T1 | a1 | ) | [inline] |
a1 | the first argument |
References NS_FATAL_ERROR.
void ns3::Timer::SetDelay | ( | const Time & | delay | ) |
delay | the delay |
void ns3::Timer::SetFunction | ( | MEM_PTR | memPtr, | |
OBJ_PTR | objPtr | |||
) | [inline] |
memPtr | the member function pointer | |
objPtr | the pointer to object |
void ns3::Timer::SetFunction | ( | FN | fn | ) | [inline] |
void ns3::Timer::Suspend | ( | void | ) |
Cancel the timer and save the amount of time left until it was set to expire. Calling Suspend on a non-running timer is an error.