00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #if !defined(AFX_TIMERMANAGER_H__FD665152_A2CC_41FF_B61D_7E192A47B82D__INCLUDED_)
00028 #define AFX_TIMERMANAGER_H__FD665152_A2CC_41FF_B61D_7E192A47B82D__INCLUDED_
00029
00030 #if _MSC_VER > 1000
00031 #pragma once
00032 #endif // _MSC_VER > 1000
00033
00034 #include "Object.h"
00035 #include "ObjectDictionary.h"
00036 #include "Timer.h"
00037 #include "JTime.h"
00038
00039 namespace cmlabs {
00040
00041 class TimerManager : public Object, public TimerObjectReceiver
00042 {
00043 public:
00044 TimerManager();
00045 virtual ~TimerManager();
00046
00047 Object* clone() const {return NULL;}
00048 bool unitTest();
00049
00050
00051 JString createTimer(JString strData, long ms);
00052
00053 JString createTimer(Object* obj, long ms);
00054
00055 JString createTimer(JString strData, long ms, void (*function)(JString id));
00056
00057 JString createTimer(Object* obj, long ms, void (*function)(Object* object));
00058
00059 JString createTimer(JString strData, long ms, TimerReceiver* receiver);
00060
00061 JString createTimer(Object* obj, long ms, TimerObjectReceiver* receiver);
00062
00063 void doMaintenance();
00064
00065
00066 bool cancel(JString id);
00067
00068 bool cancelAll();
00069
00070
00071 long waitFor(JString id);
00072
00073 long msLeft(JString id);
00074
00075
00076 int getActiveTimerCount();
00077
00078
00079 Collection getActiveTimerIDs();
00080
00081
00082 bool receiveTimerObject(Object* obj);
00083
00084 protected:
00085 ObjectDictionary* timerList;
00086
00087 Timer* getTimer(JString id);
00088 };
00089
00090 }
00091
00092 #endif // !defined(AFX_TIMERMANAGER_H__FD665152_A2CC_41FF_B61D_7E192A47B82D__INCLUDED_)