Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields

event.h

00001 /***************************************************************************
00002                           event.h  -  description
00003                              -------------------
00004     begin                : Thu Apr 8 2004
00005     copyright            : (C) 2004 by Daroth-U
00006     email                : daroth-u@ifrance.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
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   // For debug purpose
00040   static int globalId;  
00041   int eventId;  // unique  
00042   bool cancelEvent;
00043 
00044 public:
00045   
00046   
00047   enum {
00048     INFINITE_EXECUTIONS = -1 
00049   }; 
00050    
00051   // This event will occur nbExecutionsTD time every tmOut from currentDate.  
00052   Event(Date currentDate, Date tmOut, long nbExecutionsToDo);
00053   
00054   // This event will occur only one time at the given date
00055   Event(Date eventDate);
00056   
00057   Event(); 
00058   virtual ~Event();
00059   
00060   //virtual void execute()=0;
00061   virtual void execute() { cout << "Event.cpp : execute function should'nt be called by event base class!" << endl; }
00062   
00063   // this is called before the event is deleted (It's only called once.)
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

Generated on Thu Jun 16 21:50:43 2005 for scourge by  doxygen 1.4.0