00001 #ifndef REPEAT_TIMER_H
00002 #define REPEAT_TIMER_H 1
00003
00004 #include <omnetpp.h>
00005 #include "RepeatTimerCore.h"
00006 #include "BaseModule.h"
00007
00008
00009
00010
00011
00012 class RepeatTimer {
00013 friend class RepeatTimerCore;
00014 protected:
00015 RepeatTimerCore * core;
00016 BaseModule *owner;
00017 public:
00018 virtual ~RepeatTimer() {
00019 delete core;
00020 }
00021 void setRepeatTimer(unsigned int index, double period, int repeats = 1) {
00022 core->setRepeatTimer(index, period, repeats);
00023 }
00024 unsigned int setRepeatTimer(double period, int repeats = 1) {
00025 return core->setRepeatTimer(period, repeats);
00026 }
00027 void cancelRepeatTimer(unsigned int index) {
00028 core->cancelRepeatTimer(index);
00029 }
00030 void resetRepeatTimer(unsigned int index) {
00031 core->resetRepeatTimer(index);
00032 }
00033 void resetAllRepeatTimers(void) {
00034 core->resetAllRepeatTimers();
00035 }
00036 bool timerExists(unsigned int index) {
00037 return core->timerExists(index);
00038 }
00039
00040 float remainingRepeatTimer(unsigned int index) {
00041 return core->remainingRepeatTimer(index);
00042 }
00043 void setContextPointer(unsigned int index,void * data) {
00044 core->setContextPointer(index,data);
00045 }
00046 void * contextPointer(unsigned int index) {
00047 return core->contextPointer(index);
00048 }
00049 void setContextDestructor(unsigned int index, void (*func)(void * data)) {
00050 core->setContextDestructor(index,func);
00051 }
00052 void allocateRepeatTimers(unsigned int count) {
00053 core->allocateRepeatTimers(count);
00054 }
00055 void deleteRepeatTimer(unsigned int index) {
00056 core->deleteRepeatTimer(index);
00057 }
00058
00059 virtual void init(BaseModule * parent);
00060 virtual void handleRepeatTimer(unsigned int index){}
00061 };
00062
00063 #endif