MFC Grid manual

CTimer Class Reference

Singleton. It manages the timers in its own thread. More...

#include <Dapfor/Common/Timer.h>

List of all members.


Static Public Member Functions

static bool StartTimer (ICallBack *callBack, int timerId, unsigned int elapsedTime)
 Starts a new timer with specified id and callback.
static bool StopTimer (ICallBack *callBack, int timerId)
 Stops a timer with specified id and callback.
static void Initialize ()
 Initializes a timer.
static void UnInitialize ()
 Uninitializes a timer.

Classes

struct  ICallBack
 Callback interface to be called when a timer expires. More...

Detailed Description

Singleton. It manages the timers in its own thread.

When the timer expires, the appropriate subscriber is notified by calling ICallBack::OnExpire

Note:
The notification comes in the timer's thread.

Member Function Documentation

bool StartTimer ( ICallBack callBack,
int  timerId,
unsigned int  elapsedTime 
) [static]

Starts a new timer with specified id and callback.

The callback function is called only once. To restart the timer, CTimer::StartTimer function should be called again.

Parameters:
[in] callBack Pointer to ICallBack interface.
[in] timerId Timer identifier which will be passed to the callback interface
[in] elapsedTime Specifies time-out value, in milliseconds.
Returns:
True if the timer is successfully started. Otherwise false.
Note:
The callback is called in the timer's thread.
Thread safety
The function is thread-safe.

bool StopTimer ( ICallBack callBack,
int  timerId 
) [static]

Stops a timer with specified id and callback.

Parameters:
[in] callBack Pointer to ICallBack interface.
[in] timerId Timer identifier.
Returns:
True if the timer is successfully stopped. Otherwise false.
Thread safety
The function is thread-safe.

void Initialize (  )  [static]

Initializes a timer.

Thread safety
The function is thread-safe.

void UnInitialize (  )  [static]

Uninitializes a timer.

Thread safety
The function is thread-safe.