Yate
SignallingTimer Class Reference

A signalling timer. More...

#include <yatesig.h>

Inheritance diagram for SignallingTimer:
SignallingMessageTimer

Public Member Functions

 SignallingTimer (u_int64_t interval, u_int64_t time=0)
 
void interval (u_int64_t value)
 
void interval (const NamedList &params, const char *param, unsigned int minVal, unsigned int defVal, bool allowDisable, bool sec=false)
 
u_int64_t interval () const
 
u_int64_t fireTime () const
 
void start (u_int64_t time=Time::msecNow())
 
void fire (u_int64_t time=Time::msecNow())
 
void stop ()
 
bool started () const
 
bool timeout (u_int64_t time=Time::msecNow()) const
 

Static Public Member Functions

static unsigned int getInterval (const NamedList &params, const char *param, unsigned int minVal, unsigned int defVal, unsigned int maxVal=0, bool allowDisable=false)
 

Detailed Description

A signalling timer.

Timer management class. Used to manage timeouts. The time is kept in miliseconds

Constructor & Destructor Documentation

◆ SignallingTimer()

SignallingTimer ( u_int64_t interval,
u_int64_t time = 0 )
inline

Constructor

Parameters
intervalThe timeout interval. Set to 0 to disable
timeOptional timeout value. If non 0, the timer is started

References interval(), and start().

Referenced by SignallingMessageTimer::global(), SignallingMessageTimer::global(), and SignallingMessageTimer::SignallingMessageTimer().

Member Function Documentation

◆ fire()

void fire ( u_int64_t time = Time::msecNow())
inline

Fire the timer at a specific absolute time

Parameters
timeAbsolute time (in msec) when the timer will fire

References Time::msecNow().

◆ fireTime()

u_int64_t fireTime ( ) const
inline

Get the time this timer will fire (timeout)

Returns
The timeout (fire) time

Referenced by SignallingMessageTimer::fireTime().

◆ getInterval()

static unsigned int getInterval ( const NamedList & params,
const char * param,
unsigned int minVal,
unsigned int defVal,
unsigned int maxVal = 0,
bool allowDisable = false )
static

Retrieve a timer interval from a list of parameters.

Parameters
paramsThe list of parameters
paramThe name of the parameter containing the timer interval value
minValMinimum value allowed for the timer interval
defValDefault value if it fails to get one from the given parameter
maxValOptional interval maximum value
allowDisableTrue to allow 0 for the timer interval
Returns
The interval value

Referenced by interval().

◆ interval() [1/3]

u_int64_t interval ( ) const
inline

Get the timeout interval

Returns
The timeout interval

◆ interval() [2/3]

void interval ( const NamedList & params,
const char * param,
unsigned int minVal,
unsigned int defVal,
bool allowDisable,
bool sec = false )
inline

Set the timeout interval from a list of parameters. The interval value is checked to be at least minVal or 0 if allowDisable is true

Parameters
paramsThe list of parameters
paramThe name of the parameter containing the timer interval value
minValMinimum value allowed for the timer interval
defValDefault value if it fails to get one from the given parameter
allowDisableTrue to allow 0 for the timer interval
secTrue if the interval value if given in seconds

References getInterval().

◆ interval() [3/3]

void interval ( u_int64_t value)
inline

Set the timeout interval

Parameters
valueThe new timeout value

Referenced by SignallingMessageTimer::SignallingMessageTimer(), and SignallingTimer().

◆ start()

void start ( u_int64_t time = Time::msecNow())
inline

Start the timer if enabled (interval is positive)

Parameters
timeTime to be added to the interval to set the timeout point

References Time::msecNow().

Referenced by SignallingTimer().

◆ started()

bool started ( ) const
inline

Check if the timer is started

Returns
True if the timer is started

Referenced by timeout().

◆ stop()

void stop ( )
inline

Stop the timer

◆ timeout()

bool timeout ( u_int64_t time = Time::msecNow()) const
inline

Check if the timer is started and timed out

Parameters
timeThe time to compare with
Returns
True if the timer timed out

References Time::msecNow(), and started().


The documentation for this class was generated from the following file: