00001 //--- < TIMEDEVENTMANAGER.H > ---| ViewGraph - A Flexible Graph view Framework | 00002 // 00003 // TimedEventManager classes accept timed 00004 // events from nodes within the scene. 00005 // Each manager should handle one O/S window. 00006 // 00007 // Give such a manager control once in a 00008 // while to process those events. 00009 // Events that missed their time by a 00010 // large value will be loudly ignored. 00011 // 00012 // 00013 // $Author: botik32 $ 00014 // $Revision: 1.2 $ 00015 // $Date: 2004/04/18 09:22:01 $ 00016 //-----------------------------------------------------------------------------/ 00017 00018 #ifndef TIMEDEVENTMANAGER_H 00019 #define TIMEDEVENTMANAGER_H 00020 00021 00022 class Event; 00023 class TimedEvent; 00024 class TimedEventNode; 00025 00026 class TimedEventManager 00027 { 00028 protected: 00029 // defines timeout threshold to recognize 00030 // late events 00031 int timeout; 00032 int eventcnt; 00033 TimedEventNode *eventq; 00034 //std::multimap<unsigned long, TimedEvent*> eventq; 00035 00036 // timebase is initialized in constructor and 00037 // all time values are deducted this value 00038 unsigned long timebase; 00039 // currtime is advanced from a call as not to 00040 // waste time asking time() 00041 unsigned long currtime; 00042 00043 // tick_events has been removed 00044 // updates timeleft for all the events in the queue. 00045 // This might seem stupid and maybe it is, but 00046 // it keeps the timedevents unaware of time 00047 // representation. "Which is good. (c)Homer Simpson." 00048 // void tick_events( int delta ); 00049 public: 00050 TimedEventManager( int ); 00051 void enqueue_event( int delay, Event * ); 00052 Event* next_ready_event( void ); 00053 00054 // fixes time overlap in timebase in cases of very 00055 // long uptime, should be called once every ten 00056 // seconds or so 00057 void fix_timeoverlap( void ); 00058 00059 // This function updates the object's time by real time. 00060 // It should be called in the main loop of your program 00061 void advance_time( void ); 00062 00063 // free the remaining timed events from the queue 00064 ~TimedEventManager(); 00065 }; 00066 00067 #endif 00068 00069 /// $Log: timedeventmanager.h,v $ 00070 /// Revision 1.2 2004/04/18 09:22:01 botik32 00071 /// Changes to groupnode interface, timedeventmanager interface 00072 /// and implementation 00073 /// 00074 /// Revision 1.1.1.1 2004/03/26 10:50:26 botik32 00075 /// Initial release 00076 /// 00077 /// Revision 1.1.1.1 2004/03/26 08:53:33 botik 00078 /// initial import 00079 /// 00080 /// 00081 /// Revision 1.1 2003/11/20 14:59:12 botik 00082 /// Added TimedEvent and TimedEventManager class. 00083 /// These will allow us to (hopefully) fix the 00084 /// borderlayer scrolling which sucks badly. 00085 ///