00001 // ===================================================================== 00041 // ===================================================================== 00042 #ifndef CLDAQ__TEVENTMANAGER_HH 00043 #define CLDAQ__TEVENTMANAGER_HH 00044 00045 #include "Tglobals.h" 00046 #include "TEvent.hh" 00047 //#include "TSystemTimer.hh" 00048 00049 class TRun; 00050 class TEventAction; 00051 00052 00072 class TEventManager 00073 { 00074 00075 private: 00076 static TEventManager* theEventManager; 00077 00078 public: 00079 enum { tDefaultStackSize = 100 }; 00080 00081 private: 00082 Tstatus_t theStatus; 00083 Tint theStackSize; 00084 Tint theNumberOfEvents; 00085 TEventAction* theEventAction; 00086 TEvent theEvent; 00087 //TSystemTimer theEventTimer; 00088 Tint theLastAccessID; 00089 00090 public: 00091 TEventManager( Tint stacksize = tDefaultStackSize ); 00092 virtual ~TEventManager(); 00093 00094 public: 00095 Tint GetStackSize() const; 00096 Tint GetNumberOfEvents() const; 00097 const TEvent& GetEvent() const; 00098 TEvent& GetEvent(); 00099 TEventAction* GetEventAction() const; 00100 Tvoid SetStackSize( Tint stacksize ); 00101 Tvoid SetNumberOfEvents( Tint nevents ); 00102 Tvoid SetEvent( const TEvent& event ); 00103 Tvoid SetEventAction( TEventAction* action ); 00104 Tstatus_t GetStatus() const; 00105 Tvoid SetStatus( Tstatus_t status ); 00106 //const TSystemTimer& GetEventTimer() const; 00107 //TSystemTimer& GetEventTimer(); 00108 //Tvoid SetEventTimer( const TSystemTimer& timer ); 00109 Tint GetLastAccessID() const; 00110 Tvoid SetLastAccessID( Tint id ); 00111 00112 public: 00113 Tvoid ClearEventStack(); 00114 Tint FindEvent( Tint id ) const; 00115 Tbool HasEvent( Tint id ) const; 00116 Tvoid TouchNewestEvent(); 00117 TEvent GetNewestEvent(); 00118 TEvent GetNextEvent(); 00119 TEvent GetLastEvent(); 00120 TEvent GetEvent( Tint id ); 00121 00122 public: 00123 virtual const TRun& RecordEvent(); 00124 virtual const TEvent& TakeEvent(); 00125 virtual Tvoid ShowStatus() const; 00126 virtual Tvoid Clear(); 00127 00128 public: 00129 static TEventManager* GetEventManager(); 00130 00131 #ifdef __CLDAQ_ROOT_DLL 00132 ClassDef(TEventManager,0) 00133 #endif 00134 00135 }; 00136 00137 inline TEventManager* TEventManager::GetEventManager() 00138 { 00139 return theEventManager; 00140 } 00141 00142 inline Tint TEventManager::GetStackSize() const 00143 { 00144 return theStackSize; 00145 } 00146 00147 inline Tint TEventManager::GetNumberOfEvents() const 00148 { 00149 return theNumberOfEvents; 00150 } 00151 00152 inline const TEvent& TEventManager::GetEvent() const 00153 { 00154 return theEvent; 00155 } 00156 00157 inline TEvent& TEventManager::GetEvent() 00158 { 00159 return theEvent; 00160 } 00161 00162 inline TEventAction* TEventManager::GetEventAction() const 00163 { 00164 return theEventAction; 00165 } 00166 00167 inline Tvoid TEventManager::SetNumberOfEvents( Tint nevents ) 00168 { 00169 theNumberOfEvents = nevents; 00170 return; 00171 } 00172 00173 inline Tvoid TEventManager::SetEvent( const TEvent& event ) 00174 { 00175 theEvent = event; 00176 return; 00177 } 00178 00179 inline Tstatus_t TEventManager::GetStatus() const 00180 { 00181 return theStatus; 00182 } 00183 00184 inline Tvoid TEventManager::SetStatus( Tstatus_t status ) 00185 { 00186 theStatus = status; 00187 return; 00188 } 00189 00190 // inline const TSystemTimer& TEventManager::GetEventTimer() const 00191 // { 00192 // return theEventTimer; 00193 // } 00194 00195 // inline TSystemTimer& TEventManager::GetEventTimer() 00196 // { 00197 // return theEventTimer; 00198 // } 00199 00200 // inline Tvoid TEventManager::SetEventTimer( const TSystemTimer& timer ) 00201 // { 00202 // theEventTimer = timer; 00203 // return; 00204 // } 00205 00206 inline Tint TEventManager::GetLastAccessID() const 00207 { 00208 return theLastAccessID; 00209 } 00210 00211 inline Tvoid TEventManager::SetLastAccessID( Tint id ) 00212 { 00213 theLastAccessID = id; 00214 return; 00215 } 00216 00217 #endif