Garmin Fleet Management Controller  2.19.0
TimerManager Class Reference

Manages timer (periodic) events. More...

#include <TimerManager.h>

Static Public Member Functions

static void addListener (TimerListener *aListener)
 Register a listener to receive periodic callbacks. More...
 
static void removeListener (TimerListener *aListener)
 Remove a TimerListener from the list that is called. More...
 
static void tick ()
 Timer tick. More...
 

Private Member Functions

 TimerManager ()
 Constructor. More...
 
virtual ~TimerManager ()
 Destructor. More...
 
void instanceAddListener (TimerListener *aListener)
 Register a listener to receive periodic callbacks. More...
 
void instanceRemoveListener (TimerListener *aListener)
 Remove a TimerListener from the list that is called. More...
 
void instanceTick ()
 Timer tick. More...
 

Static Private Member Functions

static void destroyInstance ()
 Destroy the TimerManager instance. More...
 
static TimerManagergetInstance ()
 Get the TimerManager instance. More...
 

Private Attributes

std::list< TimerListener * > mListeners
 List of objects that will get periodic notifications. More...
 

Static Private Attributes

static TimerManagersInstance = NULL
 Pointer to the one and only TimerManager instance. More...
 

Detailed Description

Manages timer (periodic) events.

The TimerManager manages the list of TimerListener objects in the application, and periodically calls their onTimer function. The application is responsible for periodically calling tick().

Definition at line 25 of file TimerManager.h.

Constructor & Destructor Documentation

TimerManager::TimerManager ( )
private

Constructor.

Definition at line 45 of file TimerManager.cpp.

Referenced by getInstance().

TimerManager::~TimerManager ( )
privatevirtual

Destructor.

Definition at line 52 of file TimerManager.cpp.

References addListener().

Member Function Documentation

void TimerManager::addListener ( TimerListener aListener)
static

Register a listener to receive periodic callbacks.

Parameters
aListenerThe listener object to add

Definition at line 61 of file TimerManager.cpp.

References getInstance(), and instanceAddListener().

Referenced by TimerListener::TimerListener(), and ~TimerManager().

void TimerManager::destroyInstance ( )
staticprivate

Destroy the TimerManager instance.

Destroy the one and only TimerManager.

Definition at line 36 of file TimerManager.cpp.

References sInstance.

Referenced by getInstance().

TimerManager * TimerManager::getInstance ( )
staticprivate

Get the TimerManager instance.

Get the instance of the TimerManager, constructing it if necessary.

Definition at line 22 of file TimerManager.cpp.

References destroyInstance(), sInstance, and TimerManager().

Referenced by addListener(), removeListener(), and tick().

void TimerManager::instanceAddListener ( TimerListener aListener)
private

Register a listener to receive periodic callbacks.

Parameters
aListenerThe listener object to add

Definition at line 73 of file TimerManager.cpp.

References mListeners, and removeListener().

Referenced by addListener().

void TimerManager::instanceRemoveListener ( TimerListener aListener)
private

Remove a TimerListener from the list that is called.

Parameters
aListenerThe listener to remove

Definition at line 98 of file TimerManager.cpp.

References mListeners.

Referenced by removeListener().

void TimerManager::instanceTick ( )
private

Timer tick.

This function is called periodically and distributes the timer event to all TimerListnener objects.

Definition at line 121 of file TimerManager.cpp.

References mListeners.

Referenced by tick().

void TimerManager::removeListener ( TimerListener aListener)
static

Remove a TimerListener from the list that is called.

Parameters
aListenerThe aListener to remove

Definition at line 86 of file TimerManager.cpp.

References getInstance(), and instanceRemoveListener().

Referenced by instanceAddListener(), and TimerListener::~TimerListener().

void TimerManager::tick ( )
static

Timer tick.

This function is called periodically and distributes the timer event to all TimerListnener objects.

Definition at line 111 of file TimerManager.cpp.

References getInstance(), and instanceTick().

Referenced by CFmiPcAppDlg::OnTimer().

Member Data Documentation

std::list<TimerListener *> TimerManager::mListeners
private

List of objects that will get periodic notifications.

Definition at line 61 of file TimerManager.h.

Referenced by instanceAddListener(), instanceRemoveListener(), and instanceTick().

TimerManager * TimerManager::sInstance = NULL
staticprivate

Pointer to the one and only TimerManager instance.

Definition at line 58 of file TimerManager.h.

Referenced by destroyInstance(), and getInstance().


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