3 #include "GaudiKernel/Bootstrap.h"
4 #include "GaudiKernel/System.h"
6 #include "GaudiKernel/IInterface.h"
7 #include "GaudiKernel/IAlgorithm.h"
8 #include "GaudiKernel/IService.h"
9 #include "GaudiKernel/IAppMgrUI.h"
10 #include "GaudiKernel/ISvcLocator.h"
11 #include "GaudiKernel/IClassManager.h"
13 #include "GaudiKernel/ObjectFactory.h"
14 #include "GaudiKernel/Service.h"
15 #include "GaudiKernel/Algorithm.h"
17 #include "GaudiKernel/IJobOptionsSvc.h"
18 #include "GaudiKernel/IEventProcessor.h"
44 #if !defined(GAUDI_V22_API)|| defined(G22_NEW_SVCLOCATOR)
50 const bool createIf =
true)
override;
52 const std::list<IService*>&
getServices( )
const override;
67 const std::string& factname)
72 if ( !s_appmgrInstance ) {
74 s_svclocInstance = s_appmgrInstance;
76 return s_appmgrInstance.
get();
81 const std::string& factname)
87 return iif ? iif.as<
IAppMgrUI>().
get() : nullptr;
107 if( !s_svclocInstance ) {
110 s_svclocInstance = iappmgr;
111 if( s_svclocInstance )
return s_svclocInstance;
124 return s_svclocInstance;
132 s_svclocInstance = newInstance;
133 s_appmgrInstance = s_svclocInstance;
142 s_appmgrInstance = newInstance;
143 s_svclocInstance = s_appmgrInstance;
149 const std::string& factname,
150 const std::string& dllname)
154 IInterface* ii = ObjFactory::create(factname,
nullptr);
156 IService* is = Service::Factory::create(factname, name,
nullptr);
158 IAlgorithm* ia = Algorithm::Factory::create(factname, name,
nullptr);
161 void* libHandle =
nullptr;
164 ii = ObjFactory::create(factname,
nullptr);
166 is = Service::Factory::create(factname, name,
nullptr);
168 ia = Algorithm::Factory::create(factname, name,
nullptr);
173 std::cout <<
"Gaudi::Bootstrap: Not found DLL " << dllname << std::endl;
194 static std::list<IService*> s_bootServices;
200 #if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
205 if ( s_appmgrInstance ) {
206 sc = s_svclocInstance->
getService(typeName, iid, pinterface );
208 pinterface = s_bootInterface.
get();
214 const bool createIf ) {
216 if ( s_appmgrInstance ) {
217 sc = s_svclocInstance->
getService(typeName, svc, createIf );
219 svc = s_bootService.
get();
226 return s_appmgrInstance ? s_svclocInstance->
getServices( )
230 return s_appmgrInstance && s_svclocInstance->
existsService(name) ;
235 return s_appmgrInstance ? s_svclocInstance->
service(typeName, createIf)
240 #ifdef GAUDI_HASCLASSVISIBILITY
241 #pragma GCC visibility push(default)
245 #define PyHelper(x) py_bootstrap_ ## x
260 return prop ? prop->
getProperty(name).toString().c_str() :
nullptr;
274 #define PyFSMHelper(s) bool py_bootstrap_fsm_ ## s (IInterface* i) \
275 { auto fsm = SmartIF<IStateful>(i); return fsm && fsm->s().isSuccess(); }
284 bool py_bootstrap_app_run(
IInterface*
i,
int maxevt) {
286 return ep &&
ep->executeRun(maxevt).isSuccess();
289 #ifdef GAUDI_HASCLASSVISIBILITY
290 #pragma GCC visibility pop
int PyHelper() ROOT_VERSION_CODE()
Base class used to implement the interfaces.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode getProperty(Property *p) const =0
Get the property by property.
const std::list< IService * > & getServices() const override
bool isSuccess() const
Test for a status code of SUCCESS.
~BootSvcLocator() override=default
bool PyHelper() addPropertyToCatalogue(IInterface *p, char *comp, char *name, char *value)
GAUDI_API IAppMgrUI * createApplicationMgrEx(const std::string &dllname, const std::string &factname)
const char *PyHelper() getProperty(IInterface *p, char *name)
TYPE * get() const
Get interface pointer.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
SimpleProperty< std::string > StringProperty
Helper class to parse a string of format "type/name".
GAUDI_API ISvcLocator * svcLocator()
SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override
Returns a smart pointer to a service.
General service interface definition.
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
virtual StatusCode setProperty(const Property &p)=0
Set the property by property.
virtual StatusCode getService(const Gaudi::Utils::TypeNameString &typeName, IService *&svc, const bool createIf=true)
Get a reference to the service given a service name.
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
The IAlgorithm is the interface implemented by the Algorithm base class.
Application Manager User Interface.
GAUDI_API ISvcLocator * setInstance(ISvcLocator *newInstance)
Set new instance of service locator.
StatusCode getService(const Gaudi::Utils::TypeNameString &typeName, const InterfaceID &iid, IInterface *&pinterface) override
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
virtual StatusCode addPropertyToCatalogue(const std::string &client, const Property &property)=0
Add a property into the JobOptions catalog.
A dual-stage boostrap mechanism is used to ensure an orderly startup of the ApplicationMgr.
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
virtual bool existsService(const std::string &name) const =0
Check the existence of a service given a service name.
virtual const std::list< IService * > & getServices() const =0
Get a reference to a service and create it if it does not exists.
bool existsService(const std::string &name) const override
std::string typeName(const std::type_info &typ)
virtual StatusCode configure()=0
Configure the job.
SmartIF< IFace > make_SmartIF(IFace *iface)
bool PyHelper() configureApp(IInterface *app)
IInterface *PyHelper() getService(IInterface *app, char *name)
Helper functions to set/get the application return code.
GAUDI_API IInterface * createInstance(const std::string &name, const std::string &factname, const std::string &ddlname)
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)