Marsyas  0.5.0-beta1
Defines
/Users/jleben/code/marsyas/src/marsyas/sched/TmTimerManager.cpp File Reference
#include <marsyas/sched/TmTimerManager.h>
#include "TmRealTime.h"
#include "TmVirtualTime.h"

Go to the source code of this file.

Defines

#define registerTimer(_NAME)   registry_[#_NAME] = new Make##_NAME();
#define TimerCreateWrapper(_NAME)

Define Documentation

#define registerTimer (   _NAME)    registry_[#_NAME] = new Make##_NAME();

Definition at line 43 of file TmTimerManager.cpp.

#define TimerCreateWrapper (   _NAME)
Value:
struct Make##_NAME : public MakeTimer { \
        Make##_NAME() {}; ~Make##_NAME() {}; \
        TmTimer* make(std::string ident) { return new _NAME (ident); }; \
    }

Adding new Timers: New timers are added by first making them... Basically, a map is created from "TimerName"=>TimerConstructorObject. This makes it possible to use a map for fast access to specific timers and it prevents having to instantiate each Timer type. The constructor object simply wraps the new operator so that it constructs objects only when requested. 1. Add the timer's include file. 2. Wrap the object using the macro: TimerCreateWrapper(TmSomeTimerName); 3. Register the timer in the map: in function TmTimerManager::addTimers() add the line registerTimer(TmSomeTimerName);

Definition at line 38 of file TmTimerManager.cpp.