21 #ifndef TRICKLE_TIMER_H
22 #define TRICKLE_TIMER_H
195 template <
typename FN>
208 template <
typename MEM_PTR,
typename OBJ_PTR>
220 template <
typename... Ts>
266 template <
typename FN>
273 template <
typename MEM_PTR,
typename OBJ_PTR>
281 template <
typename... Ts>
287 NS_FATAL_ERROR (
"You cannot set the arguments of a TrickleTimer before setting its function.");
An identifier for simulation events.
Simulation virtual time values and global simulation resolution.
The timer implementation underlying Timer and Watchdog.
void SetArgs(T1 a1)
Set the arguments to be used when invoking the expire function.
A Trickle Timer following RFC 6206.
int64_t AssignStreams(int64_t streamNum)
Assigns the stream number for the uniform random number generator to use.
uint16_t GetRedundancy(void) const
Get the Redundancy constant of the timer.
void IntervalExpire(void)
Internal callback invoked when the interval expires.
Time m_minInterval
Minimum interval.
EventId m_timerExpiration
The future event scheduled to expire the timer.
void Stop()
Stop the timer.
Time m_currentInterval
Current interval.
Time m_maxInterval
Maximum interval.
void SetParameters(Time minInterval, uint8_t doublings, uint16_t redundancy)
Set the timer parameters.
Time GetMinInterval(void) const
Get the MinInterval of the timer.
uint64_t m_ticks
Interval span (i.e., exp2(doublings)).
void TimerExpire(void)
Internal callback invoked when the timer expires.
void InconsistentEvent()
Records an inconsistent event.
Time GetIntervalLeft(void) const
void Reset()
Reset the timer.
Time GetDelayLeft(void) const
EventId m_intervalExpiration
The future event scheduled to expire the interval.
void SetFunction(FN fn)
Set the function to execute when the timer expires.
void Enable()
Enable the timer.
Time GetMaxInterval(void) const
Get the MaxInterval of the timer.
uint8_t GetDoublings(void) const
Get the doublings of the timer.
Ptr< UniformRandomVariable > m_uniRand
Object to generate uniform random numbers.
~TrickleTimer()
Destructor.
void ConsistentEvent()
Records a consistent event.
void SetArguments(Ts &&... args)
Set the arguments to be used when invoking the expire function.
TrickleTimer()
Constructor.
uint16_t m_counter
Event counter.
TimerImpl * m_impl
The timer implementation, which contains the bound callback function and arguments.
uint16_t m_redundancy
Redundancy constant.
ns3::EventId declarations.
#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.
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::RandomVariableStream declaration, and related classes.
ns3::TimerImpl declaration and implementation.