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