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"
10 #include "GaudiKernel/IAlgorithm.h"
13 #include "GaudiKernel/Service.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> > {
52  IService,
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
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
98  // implementation of IStateful::reinitialize
99  virtual StatusCode reinitialize();
100  // implementation of IStateful::reinitialize
101  virtual StatusCode restart();
102  // implementation of IService::sysItinitilaize
104  // implementation of IService::sysStart
106  // implementation of IService::sysStop
107  virtual StatusCode sysStop() { return StatusCode::SUCCESS; }
108  // implementation of IService::sysFinalize
110  // implementation of IService::sysReinitialize
112  // implementation of IService::sysRestart
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 );
126  void extSvcNameListHandler ( Property& theProp );
128  void multiThreadSvcNameListHandler( Property& theProp );
130  void dllNameListHandler ( Property& theProp );
131  void pluginDebugPropertyHandler ( Property& theProp );
132  void initLoopCheckHndlr ( Property& );
134 
135  template <class I>
137  return m_managers[I::interfaceID().id()];
138  }
139 
141  // Cache the casted pointer to ISvcManager
142  if (!m_svcManager) {
143  m_svcManager = getManager<IService>();
144  }
145  return m_svcManager;
146  }
147 
149  // Cache the casted pointer to IAlgManager
150  if (!m_algManager) {
151  m_algManager = getManager<IAlgorithm>();
152  }
153  return m_algManager;
154  }
155 
158  return m_svcLocator;
159  }
160 
161 protected:
163  StatusCode declareMultiSvcType(const std::string& name,
164  const std::string& type);
167  int prio);
168 
169  // implementation of IService::setServiceManager
171 
174 
179  StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures = false);
180 
183  typedef std::map<unsigned long, SmartIF<IComponentManager> > ManagersMap;
190 
193 
196 
197 
198  // data members
201 
209 
210 
213 
214  std::string m_name;
217 
221 
227 
228  //
229  // The public ApplicationMgr properties
230  //
231 
232  int m_evtMax;
235 
239 
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;
248  std::string m_appName;
249  std::string m_appVersion;
251  bool m_codeCheck;
253 
255 
260 
261  std::map<std::string,std::string> m_environment;
262 
265 
269 
273 
274  // Flag to activate the printout of properties
276 
279 
280 private:
281  std::vector<std::string> m_okDlls;
282 };
283 #endif // GAUDI_APPLICATIONMGR_H
ListName m_topSvcNameList
List of top level services names.
The ServiceManager class is in charge of the creation of concrete instances of Services.
void dllNameListHandler(Property &theProp)
Gaudi::StateMachine::State m_targetState
Internal State.
The AlgorithmManager class is in charge of the creation of concrete instances of Algorithms.
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
std::string m_jobOptionsType
Source type (e.g. dbase, file...)
StringArrayProperty m_createSvcNameList
void createSvcNameListHandler(Property &)
StringArrayProperty m_outStreamNameList
List of output stream names.
StringProperty m_messageSvcType
MessageSvc type.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
StatusCode decodeDllNameList()
std::map< unsigned long, SmartIF< IComponentManager > > ManagersMap
Typedef for the map of component managers, the key is the "id" field of the basic InterfaceID of the ...
SmartIF< IRunable > m_runable
Reference to the runable object.
virtual ~ApplicationMgr()
std::list< std::pair< IService *, int > > ListSvc
virtual StatusCode executeEvent(void *par)
implementation of IEventProcessor::executeEvent(void*)
int m_noOfEvtThreads
no of multiThreadSvc copies
The ISvcManager is the interface implemented by the Service Factory in the Application Manager to sup...
Definition: ISvcManager.h:29
ManagersMap m_managers
Map of known component managers.
StringArrayProperty m_declaredManagers
Property to declare the list of known managers.
std::string m_histPersName
CGL: Name of the Hist Pers Svc.
bool m_codeCheck
Activate StatusCode checking.
VectorName m_defServices
Vector default services names.
StringProperty m_outStreamType
Output stream type (obsolete?)
std::string m_appName
The name of the application.
IntegerProperty m_pluginDebugLevel
Debug level for the plugin system.
std::vector< std::string > m_okDlls
names of successfully loaded dlls
std::map< std::string, std::string > m_environment
Environment variables to set.
virtual SmartIF< ISvcLocator > & serviceLocator() const
Needed to locate the message service.
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).
Definition: StateMachine.h:12
virtual StatusCode restart()
Initialization (from RUNNING to RUNNING, via INITIALIZED).
StringArrayProperty m_dllNameList
List of DDL's names.
SmartIF< IJobOptionsSvc > m_jobOptionsSvc
Reference to JobOption service.
Property manager helper class.
Definition: PropertyMgr.h:38
CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > > base_class
virtual Gaudi::StateMachine::State targetFSMState() const
When we are in the middle of a transition, get the state where the transition is leading us...
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
SmartIF< ISvcManager > & svcManager()
int m_outputLevel
Message output level.
virtual StatusCode run()
Run the complete job (from initialize to terminate)
DLLClassManager * m_classManager
Reference to the class manager.
SmartIF< IComponentManager > & getManager()
PropertyMgr * m_propertyMgr
Reference to Property Manager.
StatusCode addMultiSvc(const Gaudi::Utils::TypeNameString &typeName, int prio)
add one or more copies of svc type/name as determined by NoOfThreads
void setServiceManager(ISvcManager *)
Gaudi::InterfaceId< IInterface, 0, 0 > iid
Interface ID.
Definition: IInterface.h:164
virtual StatusCode stopRun()
implementation of IEventProcessor::stopRun()
int m_evtMax
Number of events to be processed.
IntegerProperty m_returnCode
Property to record the error conditions occurring during the running.
void multiThreadSvcNameListHandler(Property &theProp)
Interface ID class.
Definition: IInterface.h:55
virtual const std::string & name() const
This is needed to avoid ambiguous calls to name()
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
virtual StatusCode sysFinalize()
Finalize Service.
virtual StatusCode sysInitialize()
Initialize Service.
Main interface for the JobOptions service.
string type
Definition: gaudirun.py:126
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
std::string m_jobOptionsPath
The "file" to look for properties.
BooleanProperty m_extSvcCreates
LHCb or ATLAS defn of "ExtSvc".
General service interface definition.
Definition: IService.h:19
VectorName m_svcMapping
Default mapping of services.
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
bool m_actHistory
Activate HistorySvc.
BooleanProperty m_loopCheck
For ServiceMgr initialization loop checking.
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
ListSvc m_topSvcList
List of top level services.
StringArrayProperty m_topAlgNameList
List of top level algorithms names.
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
std::string m_evtsel
Event selection.
virtual StatusCode sysStop()
Stop Service.
SmartIF< ISvcManager > m_svcManager
Cached pointer to the manager of services.
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
StringArrayProperty m_multiThreadSvcNameList
List of external services names for which we want a copy per evt thread.
virtual StatusCode sysRestart()
Re-start the Service.
virtual StatusCode queryInterface(const InterfaceID &iid, void **pinterface)
Set the void** to the pointer to the requested interface of the instance.
VectorName m_svcOptMapping
Default mapping of services.
The Application Manager class.
std::vector< std::string > VectorName
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
std::string m_runableType
Runable type.
StatusCode decodeExtSvcNameList()
Application Manager User Interface.
Definition: IAppMgrUI.h:21
void initLoopCheckHndlr(Property &)
bool m_propertiesPrint
flag to activate the printout of properties
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
void SIGoHandler(Property &theProp)
StringArrayProperty m_extSvcNameList
List of external services names.
std::list< std::string > ListName
StringProperty m_jobOptionsSvcType
JobOptionsSvc type.
StatusCode decodeCreateSvcNameList()
void evtLoopPropertyHandler(Property &theProp)
virtual StatusCode sysStart()
Start Service.
virtual StatusCode nextEvent(int maxevt)
Process the next maxevt events.
BooleanProperty m_stalledEventMonitoring
Property to enable/disable the monitoring and reporting of stalled events (enabled by default)...
std::string m_eventLoopMgr
Processing manager type.
virtual StatusCode finalize()
Finalize the job.
Runable interface definition.
Definition: IRunable.h:19
Templated class to add the standard messaging functionalities.
The IEventProcessor is the interface to process events.
void SIExitHandler(Property &theProp)
virtual StatusCode sysReinitialize()
Re-initialize the Service.
SmartIF< IAlgManager > m_algManager
Cached pointer to the manager of algorithms.
StatusCode i_startup()
Internal startup routine.
std::string m_name
Name.
IntegerProperty m_SIGo
For SI's "Go" command via callback.
virtual StatusCode initialize()
Initialize the job.
BooleanProperty m_auditTools
Defaults for auditors.
BooleanProperty m_auditAlgs
Gaudi::StateMachine::State m_state
Internal State.
Interface for classes that implement the Gaudi State Machine.
Definition: IStateful.h:17
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:22
StatusCode decodeMultiThreadSvcNameList()
virtual StatusCode terminate()
Terminate the job.
SmartIF< IAlgManager > & algManager()
void extSvcNameListHandler(Property &theProp)
void pluginDebugPropertyHandler(Property &theProp)
ApplicationMgr(IInterface *=0)
BooleanProperty m_stopOnSignal
Property to enable/disable the "stop on signal" service (enabled by default).
Base class used to implement the interfaces.
Definition: implements.h:184
std::string m_appVersion
The version of the application.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
BooleanProperty m_auditSvcs
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:22
IntegerProperty m_SIExit
For SI's "Exit" command via callback.
virtual StatusCode executeRun(int evtmax)
implementation of IEventProcessor::executeRun(int)
virtual StatusCode configure()
Configure the job.
StatusCode declareMultiSvcType(const std::string &name, const std::string &type)
declare one or more copies of svc type/name as determined by NoOfThreads