20 #ifndef TRICKLE_TIMER_H
21 #define TRICKLE_TIMER_H
195 template <
typename FN>
208 template <
typename MEM_PTR,
typename OBJ_PTR>
219 template <
typename... Ts>
263 template <
typename FN>
271 template <
typename MEM_PTR,
typename OBJ_PTR>
279 template <
typename... Ts>
286 "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.
uint8_t GetDoublings() const
Get the doublings of the timer.
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.
uint64_t m_ticks
Interval span (i.e., exp2(doublings)).
Time GetMinInterval() const
Get the MinInterval of the timer.
void InconsistentEvent()
Records an inconsistent event.
void Reset()
Reset the timer.
void TimerExpire()
Internal callback invoked when the timer expires.
EventId m_intervalExpiration
The future event scheduled to expire the interval.
Time GetDelayLeft() const
uint16_t GetRedundancy() const
Get the Redundancy constant of the timer.
void SetFunction(FN fn)
Set the function to execute when the timer expires.
void Enable()
Enable the timer.
Time GetMaxInterval() const
Get the MaxInterval 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.
Time GetIntervalLeft() const
TrickleTimer()
Constructor.
uint16_t m_counter
Event counter.
TimerImpl * m_impl
The timer implementation, which contains the bound callback function and arguments.
void IntervalExpire()
Internal callback invoked when the interval expires.
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.