00001
00002 #ifndef GAUDI_APPLICATIONMGR_H
00003 #define GAUDI_APPLICATIONMGR_H
00004
00005 #include "GaudiKernel/Kernel.h"
00006 #include "GaudiKernel/IAppMgrUI.h"
00007 #include "GaudiKernel/ISvcLocator.h"
00008 #include "GaudiKernel/IObjManager.h"
00009 #include "GaudiKernel/ISvcManager.h"
00010 #include "GaudiKernel/IAlgManager.h"
00011 #include "GaudiKernel/ICnvManager.h"
00012 #include "GaudiKernel/IClassManager.h"
00013 #include "GaudiKernel/IEventProcessor.h"
00014 #include "GaudiKernel/IProperty.h"
00015 #include "GaudiKernel/PropertyMgr.h"
00016
00017
00018 #include <list>
00019 #include <vector>
00020
00021
00022 class ServiceFactory;
00023 class AlgorithmFactory;
00024 class ConverterFactory;
00025 class DLLClassManager;
00026
00027 class IMessageSvc;
00028 class IIncidentSvc;
00029 class IRunable;
00030 class IDataManagerSvc;
00031 class IConversionSvc;
00032
00045 class ApplicationMgr : virtual public IAppMgrUI,
00046 virtual public ISvcLocator,
00047 virtual public ISvcManager,
00048 virtual public IAlgManager,
00049 virtual public ICnvManager,
00050 virtual public IObjManager,
00051 virtual public IEventProcessor,
00052 virtual public IProperty,
00053 virtual public IClassManager {
00054 public:
00055 typedef std::list<IService*> ListSvc;
00056 typedef std::list<std::string> ListName;
00057 typedef std::vector<std::string> VectorName;
00058
00059 public:
00060
00061
00062 ApplicationMgr(IInterface* = 0);
00063
00064 virtual ~ApplicationMgr();
00065
00066
00067 virtual unsigned long addRef();
00068
00069 virtual unsigned long release();
00070
00071 virtual StatusCode queryInterface(const IID& iid, void** pinterface);
00072
00073
00074 virtual StatusCode run();
00075
00076 virtual StatusCode configure();
00077
00078 virtual StatusCode terminate();
00079
00080 virtual StatusCode initialize();
00081
00082 virtual StatusCode finalize();
00083
00084 virtual StatusCode nextEvent(int maxevt);
00085
00086 virtual const std::string& state() const;
00087
00088 virtual const std::string& name() const;
00090 virtual StatusCode executeEvent(void* par);
00091
00092
00093 virtual StatusCode getService( const std::string& name, IService*& svc);
00094
00095 virtual StatusCode getService( const std::string& name, const IID& iid, IInterface*& pinterface);
00096
00097 virtual bool existsService( const std::string& name) const;
00098
00099 virtual StatusCode getService( const std::string& name, IService*& svc, bool createIf);
00100
00101 virtual std::list<IService*>& getServices( ) const;
00102
00103
00104 virtual StatusCode addService( IService* svc);
00105
00106 virtual StatusCode removeService( IService* svc);
00107
00108 virtual StatusCode declareSvcCreator( ISvcManager::SvcCreator creator, const std::string& svctype );
00109
00110 virtual StatusCode declareSvcModule( const std::string& module, const std::string& svctype );
00111
00112 virtual StatusCode declareSvcFactory( const ISvcFactory& factory, const std::string& svctype );
00113
00114 virtual StatusCode createService( const std::string& svctype, const std::string& svcname, IService*& svc );
00115
00116
00117 virtual StatusCode addAlgorithm( IAlgorithm* alg);
00118
00119 virtual StatusCode removeAlgorithm( IAlgorithm* alg);
00120
00121 virtual StatusCode declareAlgCreator( IAlgManager::AlgCreator creator, const std::string& algtype );
00122
00123 virtual StatusCode declareAlgModule( const std::string& module, const std::string& algtype );
00124
00125 virtual StatusCode declareAlgFactory( const IAlgFactory& factory, const std::string& algtype );
00126
00127 virtual StatusCode createAlgorithm( const std::string& algtype, const std::string& algname, IAlgorithm*& alg);
00128
00129 virtual StatusCode getAlgorithm( const std::string& name, IAlgorithm*& alg) const;
00130
00131 virtual bool existsAlgorithm( const std::string& name) const;
00132
00133 virtual std::list<IAlgorithm*>& getAlgorithms( ) const;
00134
00135
00136 virtual StatusCode declareCnvFactory( const ICnvFactory& factory
00137 );
00138
00139 virtual bool existsConverter( const unsigned char repSvctype,
00140 const CLID& objtype
00141 ) const;
00142
00143 virtual const ICnvFactory* factory( const unsigned char repSvctype,
00144 const CLID& objtype
00145 ) const;
00146
00147 virtual CnvIterator cnvBegin();
00148
00149 virtual CnvIterator cnvEnd();
00150
00152
00153 virtual bool existsObjFactory( const std::string& objtype
00154 ) const;
00155
00156 virtual const IFactory* objFactory( const std::string& objtype
00157 ) const;
00158
00159 virtual StatusCode declareObjFactory( const IFactory& factory
00160 );
00161
00162 virtual ObjIterator objBegin();
00163
00164 virtual ObjIterator objEnd();
00165
00166
00167 virtual StatusCode setProperty(const Property& value);
00169 virtual StatusCode setProperty( std::istream& s );
00171 virtual StatusCode setProperty( const std::string& n, const std::string& v );
00172
00173 virtual StatusCode getProperty(Property* value) const;
00174
00175 const Property& getProperty( const std::string& name ) const;
00176
00177 const std::vector<Property*>& getProperties( ) const;
00179 virtual StatusCode getProperty( const std::string& n, std::string& v ) const;
00180
00181
00182 virtual StatusCode declareFactory( const IFactory& factory );
00183
00184 virtual StatusCode loadModule( const std::string& module );
00185
00186
00187 void SIGoHandler ( Property& theProp );
00188
00189 void SIExitHandler ( Property& theProp );
00190
00191
00192 void evtLoopPropertyHandler ( Property& theProp );
00193 StatusCode decodeExtSvcNameList ( );
00194 void extSvcNameListHandler ( Property& theProp );
00195 StatusCode decodeDllNameList ( );
00196 void dllNameListHandler ( Property& theProp );
00197
00198 protected:
00199
00201 StatusCode i_startup();
00203 IService* i_connectService(const std::string& typ, const std::string& name);
00204
00205 enum State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED };
00206
00207
00208 int m_refcount;
00209 IObjManager* m_objFactory;
00210 ServiceFactory* m_svcFactory;
00211 AlgorithmFactory* m_algFactory;
00212 ConverterFactory* m_cnvFactory;
00213 DLLClassManager* m_classManager;
00214 ISvcLocator* m_svcLocator;
00215
00216 IntegerProperty m_SIGo;
00217 IntegerProperty m_SIExit;
00218 StringArrayProperty m_topAlgNameList;
00219 StringArrayProperty m_outStreamNameList;
00220
00221
00222 ListSvc m_topSvcList;
00223 ListName m_topSvcNameList;
00224
00225 std::string m_name;
00226 State m_state;
00227
00228 VectorName m_stateName;
00229 VectorName m_defServices;
00230
00231 PropertyMgr* m_propertyMgr;
00232 IMessageSvc* m_messageSvc;
00233 IRunable* m_runable;
00234 IAppMgrUI* m_processingMgr;
00235
00236
00237
00238
00239
00240 int m_evtMax;
00241 StringArrayProperty m_extSvcNameList;
00242 StringArrayProperty m_dllNameList;
00243 std::string m_jobOptionsType;
00244 std::string m_jobOptionsPath;
00245 std::string m_runableType;
00246 std::string m_eventLoopMgr;
00247 std::string m_evtsel;
00248 std::string m_histPersName;
00249
00250 };
00251 #endif // GAUDI_APPLICATIONMGR_H