00001 // ===================================================================== 00002 // $Id: TRunManager.hh,v 1.3 2003/06/30 03:44:22 goiwai Exp $ 00003 // $Name: CLDAQ-1-06-02 $ 00004 // ===================================================================== 00005 #ifndef __TRUNMANAGER_HH 00006 #define __TRUNMANAGER_HH 00007 00008 #include "Tglobals.h" 00009 #include "TRun.hh" 00010 #include "TSystemTimer.hh" 00011 #include "TSystemClock.hh" 00012 #include "TEnvironmentVariableTable.hh" 00013 00014 class TUserInterface; 00015 class TCommand; 00016 class TSystemAction; 00017 class TRunAction; 00018 class TEventAction; 00019 class TEventManager; 00020 class TSoftwareRunInformationModule; 00021 class TAnalysisManager; 00022 class TSystemTimer; 00023 class TReadoutBookDefinition; 00024 class TReadoutBook; 00025 class TCrateDefinition; 00026 class TCrate; 00027 00028 class TRunManager 00029 { 00030 00031 protected: 00032 static TRunManager* theRunManager; 00033 00034 protected: 00035 Tstatus_t theStatus; 00036 TRun theRun; 00037 TSystemAction* theSystemAction; 00038 TRunAction* theRunAction; 00039 TEventManager* theEventManager; 00040 TUserInterface* theUserInterface; 00041 Tthread_t theThreadOfEventLoop; 00042 TSoftwareRunInformationModule* theRunInformationModule; 00043 TAnalysisManager* theAnalysisManager; 00044 TSystemTimer theRunTimer; 00045 TSystemClock theRunClock; 00046 TReadoutBookDefinition* theReadoutBookDefinition; 00047 TReadoutBook* theReadoutBook; 00048 TCrateDefinition* theCrateDefinition; 00049 TCrate* theCrate; 00050 TEnvironmentVariableTable theEnvironmentVariableTable; 00051 Tint theEventLimit; 00052 00053 public: 00054 TRunManager( TUserInterface* ui = 0 ); 00055 virtual ~TRunManager(); 00056 00057 public: 00058 TUserInterface* GetUserInterface() const; 00059 const TRun& GetRun() const; 00060 TRun& GetRun(); 00061 const TRun& GetRunID() const; 00062 TRun& GetRunID(); 00063 TSystemAction* GetSystemAction() const; 00064 TRunAction* GetRunAction() const; 00065 TEventManager* GetEventManager() const; 00066 Tvoid SetUserInterface( TUserInterface* ui ); 00067 Tint SetUserCommand( TCommand* command ); 00068 Tvoid SetRun( const TRun& run ); 00069 Tvoid SetSystemAction( TSystemAction* action ); 00070 Tvoid SetRunAction( TRunAction* action ); 00071 Tvoid SetEventAction( TEventAction* action ); 00072 Tvoid SetEventManager( TEventManager* manager ); 00073 Tstatus_t GetStatus() const; 00074 Tvoid SetStatus( Tstatus_t status ); 00075 Tthread_t GetThreadOfEventLoop() const; 00076 Tvoid SetThreadOfEventLoop( Tthread_t thread ); 00077 TSoftwareRunInformationModule* GetRunInformationModule() const; 00078 TAnalysisManager* GetAnalysisManager() const; 00079 const TSystemTimer& GetRunTimer() const; 00080 TSystemTimer& GetRunTimer(); 00081 Tvoid SetRunTimer( const TSystemTimer& timer ); 00082 const TSystemClock& GetRunClock() const; 00083 TSystemClock& GetRunClock(); 00084 Tvoid SetRunClock( const TSystemClock& clock ); 00085 TReadoutBookDefinition* GetReadoutBookDefinition() const; 00086 TReadoutBook* GetReadoutBook() const; 00087 TCrateDefinition* GetCrateDefinition() const; 00088 TCrate* GetCrate() const; 00089 Tvoid SetReadoutBookDefinition( TReadoutBookDefinition* definition ); 00090 Tvoid SetCrateDefinition( TCrateDefinition* definition ); 00091 const TEnvironmentVariableTable& GetEnvironmentVariableTable() const; 00092 TEnvironmentVariableTable& GetEnvironmentVariableTable(); 00093 Tvoid SetEnvironmentVariableTable( const TEnvironmentVariableTable& table ); 00094 Tint GetEventLimit() const; 00095 Tvoid SetEventLimit( Tint nevents ); 00096 00097 public: 00098 virtual Tvoid SessionStart(); 00099 virtual Tvoid ShowStatus() const; 00100 virtual Tvoid PopupLogo() const; 00101 virtual Tvoid PopdownLogo() const; 00102 virtual Tvoid PrintAuthorInformation( Tostream& tos = Tcout ) const; 00103 virtual Tvoid ShutdownRun(); 00104 virtual Tvoid StartRun(); 00105 virtual Tvoid StartRun( Tint runid ); 00106 virtual Tvoid StopRun(); 00107 virtual Tvoid SuspendRun(); 00108 virtual Tvoid ResumeRun(); 00109 virtual Tvoid SetRunInformationModule( TSoftwareRunInformationModule* module ); 00110 virtual Tvoid SetRunInformationModule( const Tstring& id ); 00111 virtual Tvoid SetRunInformationModule( Tint slot ); 00112 virtual Tvoid SetAnalysisManager( TAnalysisManager* manager ); 00113 00114 public: 00115 static TRunManager* GetRunManager(); 00116 00117 protected: 00118 static Tvoid* doEventLoop( Tvoid* arguments ); 00119 static Tvoid* showLogo( Tvoid* arguments ); 00120 static Tvoid catchAlarmSignal( Tint sigid ); 00121 00122 public: 00123 virtual Tvoid GoEventLoop(); 00124 virtual Tvoid WaitReturnFromEventLoop(); 00125 00126 protected: 00127 virtual TstringList divide( const Tstring& input ) const; 00128 virtual Tvoid installDefaultCommand(); 00129 00130 }; 00131 00132 inline TRunManager* TRunManager::GetRunManager() 00133 { 00134 return( theRunManager ); 00135 } 00136 00137 inline TUserInterface* TRunManager::GetUserInterface() const 00138 { 00139 return( theUserInterface ); 00140 } 00141 00142 inline Tvoid TRunManager::SetRun( const TRun& run ) 00143 { 00144 theRun = run; 00145 return; 00146 } 00147 00148 inline const TRun& TRunManager::GetRun() const 00149 { 00150 return( theRun ); 00151 } 00152 00153 inline TRun& TRunManager::GetRun() 00154 { 00155 return( theRun ); 00156 } 00157 00158 inline TSystemAction* TRunManager::GetSystemAction() const 00159 { 00160 return( theSystemAction ); 00161 } 00162 00163 inline TRunAction* TRunManager::GetRunAction() const 00164 { 00165 return( theRunAction ); 00166 } 00167 00168 inline TEventManager* TRunManager::GetEventManager() const 00169 { 00170 return( theEventManager ); 00171 } 00172 00173 inline Tstatus_t TRunManager::GetStatus() const 00174 { 00175 return( theStatus ); 00176 } 00177 00178 inline Tvoid TRunManager::SetStatus( Tstatus_t status ) 00179 { 00180 theStatus = status; 00181 return; 00182 } 00183 00184 inline Tthread_t TRunManager::GetThreadOfEventLoop() const 00185 { 00186 return( theThreadOfEventLoop ); 00187 } 00188 00189 inline Tvoid TRunManager::SetThreadOfEventLoop( Tthread_t thread ) 00190 { 00191 theThreadOfEventLoop = thread; 00192 return; 00193 } 00194 00195 inline TSoftwareRunInformationModule* TRunManager::GetRunInformationModule() const 00196 { 00197 return( theRunInformationModule ); 00198 } 00199 00200 inline TAnalysisManager* TRunManager::GetAnalysisManager() const 00201 { 00202 return( theAnalysisManager ); 00203 } 00204 00205 inline const TSystemTimer& TRunManager::GetRunTimer() const 00206 { 00207 return( theRunTimer ); 00208 } 00209 00210 inline TSystemTimer& TRunManager::GetRunTimer() 00211 { 00212 return( theRunTimer ); 00213 } 00214 00215 inline TReadoutBookDefinition* TRunManager::GetReadoutBookDefinition() const 00216 { 00217 return( theReadoutBookDefinition ); 00218 } 00219 00220 inline TReadoutBook* TRunManager::GetReadoutBook() const 00221 { 00222 return( theReadoutBook ); 00223 } 00224 00225 inline TCrateDefinition* TRunManager::GetCrateDefinition() const 00226 { 00227 return( theCrateDefinition ); 00228 } 00229 00230 inline TCrate* TRunManager::GetCrate() const 00231 { 00232 return( theCrate ); 00233 } 00234 00235 inline Tvoid TRunManager::SetRunTimer( const TSystemTimer& timer ) 00236 { 00237 theRunTimer = timer; 00238 return; 00239 } 00240 00241 inline const TEnvironmentVariableTable& TRunManager::GetEnvironmentVariableTable() const 00242 { 00243 return( theEnvironmentVariableTable ); 00244 } 00245 00246 inline TEnvironmentVariableTable& TRunManager::GetEnvironmentVariableTable() 00247 { 00248 return( theEnvironmentVariableTable ); 00249 } 00250 00251 inline Tvoid TRunManager::SetEnvironmentVariableTable( const TEnvironmentVariableTable& table ) 00252 { 00253 theEnvironmentVariableTable = table; 00254 return; 00255 } 00256 00257 inline const TSystemClock& TRunManager::GetRunClock() const 00258 { 00259 return( theRunClock ); 00260 } 00261 00262 inline TSystemClock& TRunManager::GetRunClock() 00263 { 00264 return( theRunClock ); 00265 } 00266 00267 inline Tvoid TRunManager::SetRunClock( const TSystemClock& clock ) 00268 { 00269 theRunClock = clock; 00270 return; 00271 } 00272 00273 inline Tint TRunManager::GetEventLimit() const 00274 { 00275 return( theEventLimit ); 00276 } 00277 00278 inline Tvoid TRunManager::SetEventLimit( Tint nevents ) 00279 { 00280 theEventLimit = nevents; 00281 return; 00282 } 00283 00284 #endif