X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FTimer.h;fp=src%2Fapp%2FTimer.h;h=465ed64e45edc14a13faa7f462b70e35275e83a1;hb=bce16ed519add0d5398d504d2554395c43c74571;hp=0000000000000000000000000000000000000000;hpb=62c0a1d0ac98eb51418e4daa59e80b6cc97b522f;p=l2e.git diff --git a/src/app/Timer.h b/src/app/Timer.h new file mode 100644 index 0000000..465ed64 --- /dev/null +++ b/src/app/Timer.h @@ -0,0 +1,100 @@ +/* + * Timer.h + * + * Created on: Aug 10, 2012 + * Author: holy + */ + +#ifndef APP_TIMER_H_ +#define APP_TIMER_H_ + +#include +#include + +namespace app { + +template +struct TimerData { + + TimerData() : time(0), target(0), refCount(0) { } + TimerData(Time target) : time(0), target(target), refCount(0) { } + + Time time; + Time target; + int refCount; + +}; + + +template +class Timer { + +public: + Timer() : data(0) { } + ~Timer() { if (data) --data->refCount; } + Timer(TimerData