Main Page | Class Hierarchy | Class List | File List | Class Members

SST::Timer Class Reference

Class implementing timers suitable for network protocols. More...

#include <timer.h>

List of all members.

Signals

void timeout (bool failed)
 Signaled when the timer expires.


Public Member Functions

 Timer (TimerHostState *host, QObject *parent=NULL)
 Create a timer.

bool isActive () const
 Determine if the timer is currently active.

qint64 interval () const
void start (qint64 initperiod=retryMin, qint64 failperiod=failMax)
 Start or restart the timer at a specified or default interval.

void stop ()
 Stop the timer if it is currently running.

void restart ()
 Restart the timer with a longer interval after a retry.

bool failed ()
 Determine if we've reached the hard failure deadline.


Static Public Member Functions

qint64 backoff (qint64 period, qint64 maxperiod=failMax)
 Exponential backoff function for retry.


Static Public Attributes

const qint64 retryMin = 500*1000
 Default initial retry time: 500 ms.

const qint64 retryMax = 60*1000*1000
 Default max retry period: 1 minute.

const qint64 failMax = 20*1000*1000
 Default hard failure deadline: 20 seconds.


Friends

class TimerEngine


Detailed Description

Class implementing timers suitable for network protocols.

Supports exponential backoff computations for retransmissions and retries, as well as an optional "hard" failure deadline. Also can be hooked and virtualized for simulation purposes.


Constructor & Destructor Documentation

Timer::Timer TimerHostState host,
QObject *  parent = NULL
 

Create a timer.

Parameters:
parent the optional parent for the new Timer.


Member Function Documentation

bool SST::Timer::failed  )  [inline]
 

Determine if we've reached the hard failure deadline.

Returns:
true if the failure deadline has passed.

bool SST::Timer::isActive  )  const [inline]
 

Determine if the timer is currently active.

Returns:
true if the timer is ticking.

void SST::Timer::start qint64  initperiod = retryMin,
qint64  failperiod = failMax
[inline]
 

Start or restart the timer at a specified or default interval.

Parameters:
initperiod the initial timer interval in microseconds.
failperiod the hard failure interval in microseconds.

void SST::Timer::timeout bool  failed  )  [signal]
 

Signaled when the timer expires.

Parameters:
failure true if the hard failure deadline has been reached.


The documentation for this class was generated from the following files:
Generated on Wed Mar 28 11:48:05 2007 for SST by doxygen 1.3.4