Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes
TimeoutProvider< TOCommand, TOSubscriber > Class Template Reference

Class to generate objects giving timeout functionality. More...

#include <TimeoutProvider.h>

Inheritance diagram for TimeoutProvider< TOCommand, TOSubscriber >:
Inheritance graph
[legend]
Collaboration diagram for TimeoutProvider< TOCommand, TOSubscriber >:
Collaboration graph
[legend]

Public Member Functions

 TimeoutProvider ()
 Timeout Provide Constructor. More...
 
 ~TimeoutProvider ()
 Destructor also terminates the Timeout thread. More...
 
void stopThread ()
 Terminates the Timeout provider thread. More...
 
void requestTimeout (int32_t time_ms, TOSubscriber subscriber, const TOCommand &command)
 Request a timeout trigger. More...
 
void cancelRequest (TOSubscriber subscriber, const TOCommand &command)
 Removes timeout requests that belong to a subscriber and command. More...
 

Protected Member Functions

void run ()
 

Private Attributes

std::list< TPRequest
< TOCommand, TOSubscriber > * > 
requests
 
ost::Mutex synchLock
 
bool stop
 

Detailed Description

template<class TOCommand, class TOSubscriber>
class TimeoutProvider< TOCommand, TOSubscriber >

Class to generate objects giving timeout functionality.

Author
Erik Eliasson
Werner Dittmann

Definition at line 148 of file TimeoutProvider.h.

Constructor & Destructor Documentation

template<class TOCommand , class TOSubscriber >
TimeoutProvider< TOCommand, TOSubscriber >::TimeoutProvider ( )
inline

Timeout Provide Constructor.

Definition at line 155 of file TimeoutProvider.h.

template<class TOCommand , class TOSubscriber >
TimeoutProvider< TOCommand, TOSubscriber >::~TimeoutProvider ( )
inline

Destructor also terminates the Timeout thread.

Definition at line 160 of file TimeoutProvider.h.

Member Function Documentation

template<class TOCommand , class TOSubscriber >
void TimeoutProvider< TOCommand, TOSubscriber >::cancelRequest ( TOSubscriber  subscriber,
const TOCommand &  command 
)
inline

Removes timeout requests that belong to a subscriber and command.

See Also
requestTimeout

Definition at line 225 of file TimeoutProvider.h.

template<class TOCommand , class TOSubscriber >
void TimeoutProvider< TOCommand, TOSubscriber >::requestTimeout ( int32_t  time_ms,
TOSubscriber  subscriber,
const TOCommand &  command 
)
inline

Request a timeout trigger.

Parameters
time_msNumber of milli-seconds until the timeout is wanted. Note that a small additional period of time is added that depends on execution speed.
subscriberThe receiver of the callback when the command has timed out. This argument must not be NULL.
commandSpecifies the String command to be passed back in the callback.

Definition at line 183 of file TimeoutProvider.h.

template<class TOCommand , class TOSubscriber >
void TimeoutProvider< TOCommand, TOSubscriber >::run ( void  )
inlineprotected

Definition at line 242 of file TimeoutProvider.h.

template<class TOCommand , class TOSubscriber >
void TimeoutProvider< TOCommand, TOSubscriber >::stopThread ( )
inline

Terminates the Timeout provider thread.

Definition at line 167 of file TimeoutProvider.h.

Field Documentation

template<class TOCommand , class TOSubscriber >
std::list<TPRequest<TOCommand, TOSubscriber> *> TimeoutProvider< TOCommand, TOSubscriber >::requests
private

Definition at line 285 of file TimeoutProvider.h.

template<class TOCommand , class TOSubscriber >
bool TimeoutProvider< TOCommand, TOSubscriber >::stop
private

Definition at line 289 of file TimeoutProvider.h.

template<class TOCommand , class TOSubscriber >
ost::Mutex TimeoutProvider< TOCommand, TOSubscriber >::synchLock
private

Definition at line 287 of file TimeoutProvider.h.


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