ApparatusFramework::TimerMgr Class Reference
[Pattern Services]

#include <PatternServices/current/include/TimerMgr.h>

Inheritance diagram for ApparatusFramework::TimerMgr:
ApparatusFramework::Task ApparatusFramework::Monitor

List of all members.

Classes

struct  Timer

Public Types

typedef unsigned int TimerId

Public Member Functions

void createTimer (const Timeout delay, TimerId *timerId)
void createTimer (const Timeout delay, Task *task, TimerId *timerId)
void cancelTimer (const TimerId timerId)

Static Public Member Functions

static TimerMgrCreate ()
static TimerMgrDefault ()
static bool IsCreated ()

Public Attributes

const MsgId m_theTimerMsgId

Static Public Attributes

static const TimerId IllegalTimerId

Protected Member Functions

virtual void runBody ()

Detailed Description

The timer manager is responsible for the management of timers. The manager accepts request for timeout events. Once such a timeout is elapsed it sends an informative message to the registered creator of this timer. A created and not elapsed timer can be cancelled at any time. The timer manager inherits form the monitor class to protect itself against concurrent access. It inherits from tasks to handle the timeout events by its own. timerId A message containing the identification of the elapsed timer is sent to the registered task. The message informs the task that this timer elapsed. The ID is the same as the one returned upon the creation of the timer.

Definition at line 177 of file TimerMgr.h.


Member Typedef Documentation

static members Type for the unique timer ids.

Definition at line 199 of file TimerMgr.h.


Member Function Documentation

void ApparatusFramework::TimerMgr::cancelTimer ( const TimerId  timerId  ) 

Cancels the timer with the given identifier. The operation is successfully only if the timer is still pending.

Parameters:
timerId identifier of the timer object to be canceled.
static TimerMgr* ApparatusFramework::TimerMgr::Create (  )  [static]

singleton methods Creates an instance of the singleton if none exists yet. The object is created in static memory.

Returns:
A pointer to the created singleton instance.
void ApparatusFramework::TimerMgr::createTimer ( const Timeout  delay,
Task task,
TimerId timerId 
)

Creates a new timer with the given timeout in milliseconds. The returned timer identifier can be used to later manipulate the timer object.

Parameters:
delay the elapsed time before a timeout event is sent to the creator.
timerId the identifier of the timer object.
task task to which the timeout message is sent.
void ApparatusFramework::TimerMgr::createTimer ( const Timeout  delay,
TimerId timerId 
)

timeout handling Creates a new timer with the given timeout in milliseconds. The returned timer identifier can be used to later manipulate the timer object.

Parameters:
delay the elapsed time before a timeout event is sent to the creator.
timerId the identifier of the timer object.
static TimerMgr* ApparatusFramework::TimerMgr::Default (  )  [static]

References an instance that has been previously created.

Returns:
A pointer to the singleton instance.
static bool ApparatusFramework::TimerMgr::IsCreated (  )  [static]

States whether an instance of this singleton has been created.

Returns:
True if an instance has been created, false otherwise.
virtual void ApparatusFramework::TimerMgr::runBody (  )  [protected, virtual]

tasking Body of the timer manager task.

Reimplemented from ApparatusFramework::Task.


Member Data Documentation

Unique value identifying an undefined timer object.

Definition at line 203 of file TimerMgr.h.

Holds the constant message id that each messages has if it was sent from the message manager

Definition at line 208 of file TimerMgr.h.

© 2004-2010 bbv Software Services AG / Apparatus Services