| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ApplicationMgr.h
Go to the documentation of this file.
1 #ifndef GAUDI_APPLICATIONMGR_H
2 #define GAUDI_APPLICATIONMGR_H
3
4 #include "GaudiKernel/Kernel.h"
5 #include "GaudiKernel/IAppMgrUI.h"
6 #include "GaudiKernel/IEventProcessor.h"
7 #include "GaudiKernel/IProperty.h"
8 #include "GaudiKernel/IStateful.h"
9 #include "GaudiKernel/IComponentManager.h"
10 #include "GaudiKernel/IAlgorithm.h"
11 #include "GaudiKernel/IAlgManager.h"
12 #include "GaudiKernel/ISvcManager.h"
13 #include "GaudiKernel/Service.h"
14 #include "GaudiKernel/CommonMessaging.h"
15 #include "GaudiKernel/PropertyMgr.h"
16
17 // STL include files
18 #include <list>
19 #include <vector>
20
21 // Forward declarations
22 class ISvcLocator;
23 class ServiceManager;
24 class AlgorithmManager;
25 class DLLClassManager;
26
27 class IMessageSvc;
28 class IIncidentSvc;
29 class IRunable;
30 class IDataManagerSvc;
31 class IConversionSvc;
32 class IJobOptionsSvc;
33
46 class ApplicationMgr : public CommonMessaging<implements4<IAppMgrUI,
47 IEventProcessor,
48 IService,
49 IStateful> > {
50 typedef CommonMessaging<implements4<IAppMgrUI,
51 IEventProcessor,
52 IService,
53 IStateful> > base_class;
54 public:
55 typedef std::list<std::pair<IService*,int> > ListSvc;
56 typedef std::list<std::string> ListName;
57 typedef std::vector<std::string> VectorName;
58
59 public:
60
61 // default creator
62 ApplicationMgr(IInterface* = 0);
63 // virtual destructor
64 virtual ~ApplicationMgr();
65
66 // implementation of IInterface::queryInterface
67 virtual StatusCode queryInterface(const InterfaceID& iid, void** pinterface);
68
69 // implementation of IAppMgrUI::run
70 virtual StatusCode run();
71 // implementation of IAppMgrUI::configure
72 virtual StatusCode configure();
73 // implementation of IAppMgrUI::terminate
74 virtual StatusCode terminate();
75 // implementation of IAppMgrUI::initialize
76 virtual StatusCode initialize();
77 // implementation of IAppMgrUI::start
78 virtual StatusCode start();
79 // implementation of IAppMgrUI::stop
80 virtual StatusCode stop();
81 // implementation of IAppMgrUI::finalize
82 virtual StatusCode finalize();
83 // implementation of IAppMgrUI::nextEvent
84 virtual StatusCode nextEvent(int maxevt);
85 // implementation of IAppMgrUI::name
86 virtual const std::string& name() const;
88 virtual StatusCode executeEvent(void* par);
90 virtual StatusCode executeRun(int evtmax);
92 virtual StatusCode stopRun();
93
94 // implementation of IStateful::state
95 virtual Gaudi::StateMachine::State FSMState() const;
96 // implementation of IStateful::targetState
97 virtual Gaudi::StateMachine::State targetFSMState() const;
98 // implementation of IStateful::reinitialize
99 virtual StatusCode reinitialize();
100 // implementation of IStateful::reinitialize
101 virtual StatusCode restart();
102 // implementation of IService::sysItinitilaize
103 virtual StatusCode sysInitialize() { return StatusCode::SUCCESS; }
104 // implementation of IService::sysStart
105 virtual StatusCode sysStart() { return StatusCode::SUCCESS; }
106 // implementation of IService::sysStop
107 virtual StatusCode sysStop() { return StatusCode::SUCCESS; }
108 // implementation of IService::sysFinalize
109 virtual StatusCode sysFinalize() { return StatusCode::SUCCESS; }
110 // implementation of IService::sysReinitialize
111 virtual StatusCode sysReinitialize() { return StatusCode::SUCCESS; }
112 // implementation of IService::sysRestart
113 virtual StatusCode sysRestart() { return StatusCode::SUCCESS; }
114
115 // SI Go Handler
116 void SIGoHandler ( Property& theProp );
117 // SI Exit handler
118 void SIExitHandler ( Property& theProp );
119
121
122 void evtLoopPropertyHandler ( Property& theProp );
123 StatusCode decodeExtSvcNameList ( );
124 StatusCode decodeCreateSvcNameList ( );
125 void createSvcNameListHandler(Property &);
126 void extSvcNameListHandler ( Property& theProp );
127 StatusCode decodeMultiThreadSvcNameList( );
128 void multiThreadSvcNameListHandler( Property& theProp );
129 StatusCode decodeDllNameList ( );
130 void dllNameListHandler ( Property& theProp );
131 void pluginDebugPropertyHandler ( Property& theProp );
132 void initLoopCheckHndlr ( Property& );
134
135 template <class I>
136 SmartIF<IComponentManager> &getManager() {
137 return m_managers[I::interfaceID().id()];
138 }
139
140 inline SmartIF<ISvcManager> &svcManager() {
141 // Cache the casted pointer to ISvcManager
142 if (!m_svcManager) {
143 m_svcManager = getManager<IService>();
144 }
145 return m_svcManager;
146 }
147
148 inline SmartIF<IAlgManager> &algManager() {
149 // Cache the casted pointer to IAlgManager
150 if (!m_algManager) {
151 m_algManager = getManager<IAlgorithm>();
152 }
153 return m_algManager;
154 }
155
157 virtual SmartIF<ISvcLocator>& serviceLocator() const {
158 return m_svcLocator;
159 }
160
161 protected:
163 StatusCode declareMultiSvcType(const std::string& name,
164 const std::string& type);
166 StatusCode addMultiSvc(const Gaudi::Utils::TypeNameString &typeName,
167 int prio);
168
169 // implementation of IService::setServiceManager
170 void setServiceManager(ISvcManager*) {}
171
173 StatusCode i_startup();
174
179 StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures = false);
180
183 typedef std::map<unsigned long, SmartIF<IComponentManager> > ManagersMap;
187 ManagersMap m_managers;
189 StringArrayProperty m_declaredManagers;
190
192 SmartIF<ISvcManager> m_svcManager;
193
195 SmartIF<IAlgManager> m_algManager;
196
197
198 // data members
199 DLLClassManager* m_classManager;
200 mutable SmartIF<ISvcLocator> m_svcLocator;
201
202 IntegerProperty m_SIGo;
203 IntegerProperty m_SIExit;
204 StringArrayProperty m_topAlgNameList;
205 StringArrayProperty m_outStreamNameList;
206 StringProperty m_outStreamType;
207 StringProperty m_messageSvcType;
208 StringProperty m_jobOptionsSvcType;
209
210
211 ListSvc m_topSvcList;
212 ListName m_topSvcNameList;
213
214 std::string m_name;
215 Gaudi::StateMachine::State m_state;
216 Gaudi::StateMachine::State m_targetState;
217
218 VectorName m_defServices;
219 VectorName m_svcMapping;
220 VectorName m_svcOptMapping;
221
222 PropertyMgr* m_propertyMgr;
223 SmartIF<IMessageSvc> m_messageSvc;
224 SmartIF<IRunable> m_runable;
225 SmartIF<IEventProcessor> m_processingMgr;
226 SmartIF<IJobOptionsSvc> m_jobOptionsSvc;
227
228 //
229 // The public ApplicationMgr properties
230 //
231
232 int m_evtMax;
233 StringArrayProperty m_extSvcNameList;
234 BooleanProperty m_extSvcCreates;
235
237 StringArrayProperty m_multiThreadSvcNameList;
238 int m_noOfEvtThreads;
239
240 StringArrayProperty m_dllNameList;
241 std::string m_jobOptionsType;
242 std::string m_jobOptionsPath;
243 std::string m_runableType;
244 std::string m_eventLoopMgr;
245 std::string m_evtsel;
246 std::string m_histPersName;
247 int m_outputLevel;
248 std::string m_appName;
249 std::string m_appVersion;
250 bool m_actHistory;
251 bool m_codeCheck;
252 IntegerProperty m_pluginDebugLevel;
253
254 StringArrayProperty m_createSvcNameList;
255
257 BooleanProperty m_auditTools;
258 BooleanProperty m_auditSvcs;
259 BooleanProperty m_auditAlgs;
260
261 std::map<std::string,std::string> m_environment;
262
264 BooleanProperty m_loopCheck;
265
268 BooleanProperty m_stopOnSignal;
269
272 BooleanProperty m_stalledEventMonitoring;
273
274 // Flag to activate the printout of properties
275 bool m_propertiesPrint ;
276
278 IntegerProperty m_returnCode;
279
280 private:
281 std::vector<std::string> m_okDlls;
282 };
283 #endif // GAUDI_APPLICATIONMGR_H