23 lines
561 B
C++
23 lines
561 B
C++
// ======================================================
|
|
//
|
|
// Template for derievd Timers
|
|
//
|
|
// ======================================================
|
|
|
|
#ifndef TIMERT_H
|
|
#define TIMERT_H
|
|
|
|
#include "Timer.h"
|
|
|
|
template <class Target> class TimerT : public Timer {
|
|
public:
|
|
typedef void (Target::*TargetFunc)();
|
|
TimerT(Target &target, TargetFunc targetFunc) : myTarget(target), myTargetFunc(targetFunc) {}
|
|
|
|
private:
|
|
void doExpired() { (myTarget.*myTargetFunc)(); }
|
|
Target &myTarget;
|
|
TargetFunc myTargetFunc;
|
|
};
|
|
|
|
#endif |