User Manual, Developers Guide and API Documentation

wns::events::PeriodicRealTimeout Class Reference

Mixin to support classes that need a periodic timeout mechanism. More...

#include <events/PeriodicRealTimeout.hpp>

Inheritance diagram for wns::events::PeriodicRealTimeout:

Inheritance graph
[legend]
Collaboration diagram for wns::events::PeriodicRealTimeout:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void cancelPeriodicRealTimeout ()
 Cancel the timer.
bool hasPeriodicRealTimeoutSet ()
 Is a timer set?
virtual void periodically ()=0
 Your callback. Implement this!
 PeriodicRealTimeout ()
void startPeriodicTimeout (double _period, double _delay=0.0)
 Start the periodic timer.
virtual ~PeriodicRealTimeout ()

Static Private Member Functions

static void * worker (void *_arg)

Private Attributes

wns::events::scheduler::ICommandPtr currentCommand
pthread_cond_t dataRead
double delay
pthread_mutex_t mutex
double period
bool running
pthread_t thread

Classes

class  PeriodicRealTimeoutCommand
 Command to be queued for real time execution. More...


Detailed Description

To make use of this class, simply derive from it and overload the periodically() method.

Times are given in realtime. If you are looking for periodic simulation time events, look at PeriodicTimeout instead.

Definition at line 47 of file PeriodicRealTimeout.hpp.


Constructor & Destructor Documentation

PeriodicRealTimeout::PeriodicRealTimeout (  )  [explicit]

Definition at line 37 of file PeriodicRealTimeout.cpp.

PeriodicRealTimeout::~PeriodicRealTimeout (  )  [virtual]

Definition at line 50 of file PeriodicRealTimeout.cpp.


Member Function Documentation

void PeriodicRealTimeout::cancelPeriodicRealTimeout (  ) 

Cancel a previously set timer. Silently ignore, whether the timer has not been set.

Definition at line 83 of file PeriodicRealTimeout.cpp.

bool PeriodicRealTimeout::hasPeriodicRealTimeoutSet (  ) 

Definition at line 76 of file PeriodicRealTimeout.cpp.

virtual void wns::events::PeriodicRealTimeout::periodically (  )  [pure virtual]

The deriver is forced to implement this method. It gets called periodically, whenever the timer fires.

Implemented in wns::simulator::ProbeWriter, and wns::simulator::StatusReport.

void PeriodicRealTimeout::startPeriodicTimeout ( double  _period,
double  _delay = 0.0 
)

Starts the timer with the given period in seconds. The first timeout is delayed by the given value (default 0). When the period has elapsed, the method periodically() is called. The method periodically() has to be implemented by the deriver.

If the timer has been set before, it will be silently cancelled. At any time there is only one valid timer.

Definition at line 59 of file PeriodicRealTimeout.cpp.

void * PeriodicRealTimeout::worker ( void *  _arg  )  [static, private]

Definition at line 102 of file PeriodicRealTimeout.cpp.


Member Data Documentation

Definition at line 125 of file PeriodicRealTimeout.hpp.

Definition at line 117 of file PeriodicRealTimeout.hpp.

Definition at line 120 of file PeriodicRealTimeout.hpp.

pthread_mutex_t wns::events::PeriodicRealTimeout::mutex [private]

Definition at line 118 of file PeriodicRealTimeout.hpp.

Definition at line 119 of file PeriodicRealTimeout.hpp.

Definition at line 123 of file PeriodicRealTimeout.hpp.

Definition at line 124 of file PeriodicRealTimeout.hpp.


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

Generated on Sat May 26 03:32:53 2012 for openWNS by  doxygen 1.5.5