![]() |
|
|
Generated: 18 Jul 2008 |
00001 // $Header: /local/reps/Gaudi/GaudiSvc/src/ApplicationMgr/ApplicationMgr.h,v 1.33 2008/06/02 14:21:35 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 ); 00131 00132 protected: 00134 StatusCode declareMultiSvcType(const std::string& name, 00135 const std::string& type); 00137 StatusCode addMultiSvc(const std::string& name, const std::string& type, 00138 int prio); 00139 00140 // implementation of IService::setServiceManager 00141 void setServiceManager(ISvcManager*) {} 00142 00144 StatusCode i_startup(); 00145 00150 StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures = false); 00151 00152 // data members 00153 int m_refcount; 00154 ServiceManager* m_svcManager; 00155 AlgorithmManager* m_algManager; 00156 DLLClassManager* m_classManager; 00157 ISvcLocator* m_svcLocator; 00158 00159 IntegerProperty m_SIGo; 00160 IntegerProperty m_SIExit; 00161 StringArrayProperty m_topAlgNameList; 00162 StringArrayProperty m_outStreamNameList; 00163 StringProperty m_outStreamType; 00164 StringProperty m_messageSvcType; 00165 StringProperty m_jobOptionsSvcType; 00166 00167 00168 ListSvc m_topSvcList; 00169 ListName m_topSvcNameList; 00170 00171 std::string m_name; 00172 Gaudi::StateMachine::State m_state; 00173 Gaudi::StateMachine::State m_targetState; 00174 00175 VectorName m_defServices; 00176 VectorName m_svcMapping; 00177 VectorName m_svcOptMapping; 00178 00179 PropertyMgr* m_propertyMgr; 00180 IMessageSvc* m_messageSvc; 00181 IRunable* m_runable; 00182 IEventProcessor* m_processingMgr; 00183 IJobOptionsSvc* m_jobOptionsSvc; 00184 00185 // 00186 // The public ApplicationMgr properties 00187 // 00188 00189 int m_evtMax; 00190 StringArrayProperty m_extSvcNameList; 00191 BooleanProperty m_extSvcCreates; 00192 00194 StringArrayProperty m_multiThreadSvcNameList; 00195 int m_noOfEvtThreads; 00196 00197 StringArrayProperty m_dllNameList; 00198 std::string m_jobOptionsType; 00199 std::string m_jobOptionsPath; 00200 std::string m_runableType; 00201 std::string m_eventLoopMgr; 00202 std::string m_evtsel; 00203 std::string m_histPersName; 00204 int m_outputLevel; 00205 std::string m_appName; 00206 std::string m_appVersion; 00207 bool m_actHistory; 00208 bool m_codeCheck; 00209 IntegerProperty m_reflexDebugLevel; 00210 00211 StringArrayProperty m_createSvcNameList; 00212 00214 BooleanProperty m_auditTools; 00215 BooleanProperty m_auditSvcs; 00216 BooleanProperty m_auditAlgs; 00217 00218 std::map<std::string,std::string> m_environment; 00219 00220 // Flag to activate the printout of properties 00221 bool m_propertiesPrint ; 00222 00223 private: 00224 std::vector<std::string> m_okDlls; 00225 }; 00226 #endif // GAUDI_APPLICATIONMGR_H