00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef EVENT_H
00019 #define EVENT_H
00020
00021 #include "../constants.h"
00022 #include "../date.h"
00023
00024
00029 class Date;
00030
00031 class Event {
00032
00033 private:
00034 Date eventDate;
00035 Date timeOut;
00036 long nbExecutionsToDo;
00037 long nbExecutions;
00038
00039
00040 static int globalId;
00041 int eventId;
00042 bool cancelEvent;
00043
00044 public:
00045
00046
00047 enum {
00048 INFINITE_EXECUTIONS = -1
00049 };
00050
00051
00052 Event(Date currentDate, Date tmOut, long nbExecutionsToDo);
00053
00054
00055 Event(Date eventDate);
00056
00057 Event();
00058 virtual ~Event();
00059
00060
00061 virtual void execute() { cout << "Event.cpp : execute function should'nt be called by event base class!" << endl; }
00062
00063
00064 virtual void executeBeforeDelete() { }
00065
00066 inline long getNbExecutionsToDo() { return nbExecutionsToDo; }
00067 inline long getNbExecutions() { return nbExecutions; }
00068 inline int getEventId() { return eventId; }
00069 inline void increaseNbExecutions(){ nbExecutions ++ ; }
00070 inline void setNbExecutionsToDo(int nb){ if(nb >= -1) nbExecutionsToDo = nb; else nbExecutions = 0; }
00071 inline bool isCancelEventSet() { return cancelEvent; }
00072
00073
00074 Date getEventDate() { return eventDate; }
00075 Date getTimeOut() { return timeOut; }
00076 void setEventDate(Date d) { eventDate = d; }
00077 void scheduleDeleteEvent();
00078
00079
00080 };
00081
00082 #endif