00001 // ===================================================================== 00029 // ===================================================================== 00030 #ifndef __TEVENTMANAGER_HH 00031 #define __TEVENTMANAGER_HH 00032 00033 #include "Tglobals.h" 00034 #include "TEvent.hh" 00035 //#include "TSystemTimer.hh" 00036 00037 class TRun; 00038 class TEventAction; 00039 00040 00060 class TEventManager 00061 { 00062 00063 private: 00064 static TEventManager* theEventManager; 00065 00066 public: 00067 enum { tDefaultStackSize = 100 }; 00068 00069 private: 00070 Tstatus_t theStatus; 00071 Tint theStackSize; 00072 Tint theNumberOfEvents; 00073 TEventAction* theEventAction; 00074 TEvent theEvent; 00075 //TSystemTimer theEventTimer; 00076 Tint theLastAccessID; 00077 00078 public: 00079 TEventManager( Tint stacksize = tDefaultStackSize ); 00080 virtual ~TEventManager(); 00081 00082 public: 00083 Tint GetStackSize() const; 00084 Tint GetNumberOfEvents() const; 00085 const TEvent& GetEvent() const; 00086 TEvent& GetEvent(); 00087 TEventAction* GetEventAction() const; 00088 Tvoid SetStackSize( Tint stacksize ); 00089 Tvoid SetNumberOfEvents( Tint nevents ); 00090 Tvoid SetEvent( const TEvent& event ); 00091 Tvoid SetEventAction( TEventAction* action ); 00092 Tstatus_t GetStatus() const; 00093 Tvoid SetStatus( Tstatus_t status ); 00094 //const TSystemTimer& GetEventTimer() const; 00095 //TSystemTimer& GetEventTimer(); 00096 //Tvoid SetEventTimer( const TSystemTimer& timer ); 00097 Tint GetLastAccessID() const; 00098 Tvoid SetLastAccessID( Tint id ); 00099 00100 public: 00101 Tvoid ClearEventStack(); 00102 Tint FindEvent( Tint id ) const; 00103 Tbool HasEvent( Tint id ) const; 00104 Tvoid TouchNewestEvent(); 00105 TEvent GetNewestEvent(); 00106 TEvent GetNextEvent(); 00107 TEvent GetLastEvent(); 00108 TEvent GetEvent( Tint id ); 00109 00110 public: 00111 virtual const TRun& RecordEvent(); 00112 virtual const TEvent& TakeEvent(); 00113 virtual Tvoid ShowStatus() const; 00114 virtual Tvoid Clear(); 00115 00116 public: 00117 static TEventManager* GetEventManager(); 00118 00119 }; 00120 00121 inline TEventManager* TEventManager::GetEventManager() 00122 { 00123 return theEventManager; 00124 } 00125 00126 inline Tint TEventManager::GetStackSize() const 00127 { 00128 return theStackSize; 00129 } 00130 00131 inline Tint TEventManager::GetNumberOfEvents() const 00132 { 00133 return theNumberOfEvents; 00134 } 00135 00136 inline const TEvent& TEventManager::GetEvent() const 00137 { 00138 return theEvent; 00139 } 00140 00141 inline TEvent& TEventManager::GetEvent() 00142 { 00143 return theEvent; 00144 } 00145 00146 inline TEventAction* TEventManager::GetEventAction() const 00147 { 00148 return theEventAction; 00149 } 00150 00151 inline Tvoid TEventManager::SetNumberOfEvents( Tint nevents ) 00152 { 00153 theNumberOfEvents = nevents; 00154 return; 00155 } 00156 00157 inline Tvoid TEventManager::SetEvent( const TEvent& event ) 00158 { 00159 theEvent = event; 00160 return; 00161 } 00162 00163 inline Tstatus_t TEventManager::GetStatus() const 00164 { 00165 return theStatus; 00166 } 00167 00168 inline Tvoid TEventManager::SetStatus( Tstatus_t status ) 00169 { 00170 theStatus = status; 00171 return; 00172 } 00173 00174 // inline const TSystemTimer& TEventManager::GetEventTimer() const 00175 // { 00176 // return theEventTimer; 00177 // } 00178 00179 // inline TSystemTimer& TEventManager::GetEventTimer() 00180 // { 00181 // return theEventTimer; 00182 // } 00183 00184 // inline Tvoid TEventManager::SetEventTimer( const TSystemTimer& timer ) 00185 // { 00186 // theEventTimer = timer; 00187 // return; 00188 // } 00189 00190 inline Tint TEventManager::GetLastAccessID() const 00191 { 00192 return theLastAccessID; 00193 } 00194 00195 inline Tvoid TEventManager::SetLastAccessID( Tint id ) 00196 { 00197 theLastAccessID = id; 00198 return; 00199 } 00200 00201 #endif