![]() |
|
|
Generated: 24 Nov 2008 |
00001 // $Header: /local/reps/Gaudi/GaudiSvc/src/ApplicationMgr/ApplicationMgr.h,v 1.34 2008/11/10 15:29:09 marcocle Exp $ // 00002 #ifndef GAUDI_APPLICATIONMGR_H 00003 #define GAUDI_APPLICATIONMGR_H 00004 00005 #include "GaudiKernel/Kernel.h" 00006 #include "GaudiKernel/IAppMgrUI.h" 00007 #include "GaudiKernel/IEventProcessor.h" 00008 #include "GaudiKernel/IProperty.h" 00009 #include "GaudiKernel/IStateful.h" 00010 #include "GaudiKernel/Service.h" 00011 #include "GaudiKernel/PropertyMgr.h" 00012 00013 // STL include files 00014 #include <list> 00015 #include <vector> 00016 00017 // Forward declarations 00018 class ISvcLocator; 00019 class ServiceManager; 00020 class AlgorithmManager; 00021 class DLLClassManager; 00022 00023 class IMessageSvc; 00024 class IIncidentSvc; 00025 class IRunable; 00026 class IDataManagerSvc; 00027 class IConversionSvc; 00028 class IJobOptionsSvc; 00029 00042 class ApplicationMgr : virtual public IAppMgrUI, 00043 virtual public IEventProcessor, 00044 virtual public IService, 00045 virtual public IStateful { 00046 public: 00047 typedef std::list<std::pair<IService*,int> > ListSvc; 00048 typedef std::list<std::string> ListName; 00049 typedef std::vector<std::string> VectorName; 00050 00051 public: 00052 00053 // default creator 00054 ApplicationMgr(IInterface* = 0); 00055 // virtual destructor 00056 virtual ~ApplicationMgr(); 00057 00058 // implmentation of IInterface::addRef 00059 virtual unsigned long addRef(); 00060 // implmentation of IInterface::release 00061 virtual unsigned long release(); 00062 // implementation of IInterface::queryInterface 00063 virtual StatusCode queryInterface(const InterfaceID& iid, void** pinterface); 00064 00065 // implementation of IAppMgrUI::run 00066 virtual StatusCode run(); 00067 // implementation of IAppMgrUI::configure 00068 virtual StatusCode configure(); 00069 // implementation of IAppMgrUI::terminate 00070 virtual StatusCode terminate(); 00071 // implementation of IAppMgrUI::initalize 00072 virtual StatusCode initialize(); 00073 // implementation of IAppMgrUI::start 00074 virtual StatusCode start(); 00075 // implementation of IAppMgrUI::stop 00076 virtual StatusCode stop(); 00077 // implementation of IAppMgrUI::finalize 00078 virtual StatusCode finalize(); 00079 // implementation of IAppMgrUI::nextEvent 00080 virtual StatusCode nextEvent(int maxevt); 00081 // implementation of IAppMgrUI::name 00082 virtual const std::string& name() const; 00084 virtual StatusCode executeEvent(void* par); 00086 virtual StatusCode executeRun(int evtmax); 00088 virtual StatusCode stopRun(); 00089 00090 // implementation of IService::type 00091 virtual const InterfaceID& type() const; 00092 // implementation of IStateful::state 00093 virtual Gaudi::StateMachine::State FSMState() const; 00094 // implementation of IStateful::targetState 00095 virtual Gaudi::StateMachine::State targetFSMState() const; 00096 // implementation of IStateful::reinitilaize 00097 virtual StatusCode reinitialize(); 00098 // implementation of IStateful::reinitilaize 00099 virtual StatusCode restart(); 00100 // implementation of IService::sysItinitilaize 00101 virtual StatusCode sysInitialize() { return StatusCode::SUCCESS; } 00102 // implementation of IService::sysStart 00103 virtual StatusCode sysStart() { return StatusCode::SUCCESS; } 00104 // implementation of IService::sysStop 00105 virtual StatusCode sysStop() { return StatusCode::SUCCESS; } 00106 // implementation of IService::sysFinalize 00107 virtual StatusCode sysFinalize() { return StatusCode::SUCCESS; } 00108 // implementation of IService::sysReinitialize 00109 virtual StatusCode sysReinitialize() { return StatusCode::SUCCESS; } 00110 // implementation of IService::sysRestart 00111 virtual StatusCode sysRestart() { return StatusCode::SUCCESS; } 00112 00113 // SI Go Handler 00114 void SIGoHandler ( Property& theProp ); 00115 // SI Exit handler 00116 void SIExitHandler ( Property& theProp ); 00117 00119 00120 void evtLoopPropertyHandler ( Property& theProp ); 00121 StatusCode decodeExtSvcNameList ( ); 00122 StatusCode decodeCreateSvcNameList ( ); 00123 void createSvcNameListHandler(Property &); 00124 void extSvcNameListHandler ( Property& theProp ); 00125 StatusCode decodeMultiThreadSvcNameList( ); 00126 void multiThreadSvcNameListHandler( Property& theProp ); 00127 StatusCode decodeDllNameList ( ); 00128 void dllNameListHandler ( Property& theProp ); 00129 void reflexDebugPropertyHandler ( Property& theProp ); 00130 void initLoopCheckHndlr ( Property& ); 00132 00133 protected: 00135 StatusCode declareMultiSvcType(const std::string& name, 00136 const std::string& type); 00138 StatusCode addMultiSvc(const std::string& name, const std::string& type, 00139 int prio); 00140 00141 // implementation of IService::setServiceManager 00142 void setServiceManager(ISvcManager*) {} 00143 00145 StatusCode i_startup(); 00146 00151 StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures = false); 00152 00153 // data members 00154 int m_refcount; 00155 ServiceManager* m_svcManager; 00156 AlgorithmManager* m_algManager; 00157 DLLClassManager* m_classManager; 00158 ISvcLocator* m_svcLocator; 00159 00160 IntegerProperty m_SIGo; 00161 IntegerProperty m_SIExit; 00162 StringArrayProperty m_topAlgNameList; 00163 StringArrayProperty m_outStreamNameList; 00164 StringProperty m_outStreamType; 00165 StringProperty m_messageSvcType; 00166 StringProperty m_jobOptionsSvcType; 00167 00168 00169 ListSvc m_topSvcList; 00170 ListName m_topSvcNameList; 00171 00172 std::string m_name; 00173 Gaudi::StateMachine::State m_state; 00174 Gaudi::StateMachine::State m_targetState; 00175 00176 VectorName m_defServices; 00177 VectorName m_svcMapping; 00178 VectorName m_svcOptMapping; 00179 00180 PropertyMgr* m_propertyMgr; 00181 IMessageSvc* m_messageSvc; 00182 IRunable* m_runable; 00183 IEventProcessor* m_processingMgr; 00184 IJobOptionsSvc* m_jobOptionsSvc; 00185 00186 // 00187 // The public ApplicationMgr properties 00188 // 00189 00190 int m_evtMax; 00191 StringArrayProperty m_extSvcNameList; 00192 BooleanProperty m_extSvcCreates; 00193 00195 StringArrayProperty m_multiThreadSvcNameList; 00196 int m_noOfEvtThreads; 00197 00198 StringArrayProperty m_dllNameList; 00199 std::string m_jobOptionsType; 00200 std::string m_jobOptionsPath; 00201 std::string m_runableType; 00202 std::string m_eventLoopMgr; 00203 std::string m_evtsel; 00204 std::string m_histPersName; 00205 int m_outputLevel; 00206 std::string m_appName; 00207 std::string m_appVersion; 00208 bool m_actHistory; 00209 bool m_codeCheck; 00210 IntegerProperty m_reflexDebugLevel; 00211 00212 StringArrayProperty m_createSvcNameList; 00213 00215 BooleanProperty m_auditTools; 00216 BooleanProperty m_auditSvcs; 00217 BooleanProperty m_auditAlgs; 00218 00219 std::map<std::string,std::string> m_environment; 00220 00222 BooleanProperty m_loopCheck; 00223 00224 // Flag to activate the printout of properties 00225 bool m_propertiesPrint ; 00226 00227 private: 00228 std::vector<std::string> m_okDlls; 00229 }; 00230 #endif // GAUDI_APPLICATIONMGR_H