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