xoreos  0.0.5
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Events::TimerManager Class Reference

The global timer manager. More...

#include <timerman.h>

Inheritance diagram for Events::TimerManager:
Inheritance graph
[legend]
Collaboration diagram for Events::TimerManager:
Collaboration graph
[legend]

Public Member Functions

 TimerManager ()
 
 ~TimerManager ()
 
void init ()
 
void addTimer (uint32 interval, TimerHandle &handle, const TimerFunc &func)
 Add a function to be called regularly. More...
 
void removeTimer (TimerHandle &handle)
 Remove that timer function. More...
 

Private Member Functions

void removeTimer (TimerID &id)
 

Static Private Member Functions

static uint32 timerCallback (uint32 interval, void *data)
 

Private Attributes

Common::Mutex _mutex
 
std::list< TimerID_timers
 

Additional Inherited Members

- Static Public Member Functions inherited from Common::Singleton< TimerManager >
static TimerManager & instance ()
 
static void destroy ()
 
- Protected Types inherited from Common::Singleton< TimerManager >
typedef TimerManager SingletonBaseType
 
- Protected Member Functions inherited from Common::Singleton< TimerManager >
 Singleton ()
 
virtual ~Singleton ()
 

Detailed Description

The global timer manager.

Allows registering functions to be called at specific intervals.

Definition at line 59 of file timerman.h.

Constructor & Destructor Documentation

◆ TimerManager()

Events::TimerManager::TimerManager ( )

Definition at line 41 of file timerman.cpp.

◆ ~TimerManager()

Events::TimerManager::~TimerManager ( )

Definition at line 44 of file timerman.cpp.

References _timers, and removeTimer().

Here is the call graph for this function:

Member Function Documentation

◆ addTimer()

void Events::TimerManager::addTimer ( uint32  interval,
TimerHandle handle,
const TimerFunc func 
)

Add a function to be called regularly.

Parameters
intervalThe interval in ms. The granularity is platform-dependent. The most common number is 10ms.
handleThe timer handle to use.
funcThe function to call.

Definition at line 52 of file timerman.cpp.

References Events::TimerHandle::_empty, Events::TimerHandle::_iterator, _mutex, _timers, removeTimer(), and timerCallback().

Here is the call graph for this function:

◆ init()

void Events::TimerManager::init ( )

Definition at line 49 of file timerman.cpp.

◆ removeTimer() [1/2]

void Events::TimerManager::removeTimer ( TimerHandle handle)

Remove that timer function.

Definition at line 77 of file timerman.cpp.

References Events::TimerHandle::_empty, Events::TimerHandle::_iterator, _mutex, and _timers.

Referenced by addTimer(), and ~TimerManager().

Here is the caller graph for this function:

◆ removeTimer() [2/2]

void Events::TimerManager::removeTimer ( TimerID id)
private

Definition at line 91 of file timerman.cpp.

◆ timerCallback()

uint32 Events::TimerManager::timerCallback ( uint32  interval,
void *  data 
)
staticprivate

Definition at line 98 of file timerman.cpp.

References Events::TimerHandle::_empty, Events::TimerHandle::_iterator, and TimerMan.

Referenced by addTimer().

Here is the caller graph for this function:

Member Data Documentation

◆ _mutex

Common::Mutex Events::TimerManager::_mutex
private

Definition at line 79 of file timerman.h.

Referenced by addTimer(), and removeTimer().

◆ _timers

std::list<TimerID> Events::TimerManager::_timers
private

Definition at line 81 of file timerman.h.

Referenced by addTimer(), removeTimer(), and ~TimerManager().


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