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);
52 virtual const std::list<IService*>&
getServices( )
const;
67 const std::string& factname)
72 if ( !s_appmgrInstance.
isValid() ) {
74 s_svclocInstance = s_appmgrInstance;
76 return s_appmgrInstance.
get();
81 const std::string& factname)
119 if( !s_svclocInstance.
isValid() ) {
122 s_svclocInstance = iappmgr;
123 if( s_svclocInstance.
isValid() ) {
124 return s_svclocInstance;
138 return s_svclocInstance;
146 s_svclocInstance = newInstance;
147 s_appmgrInstance = s_svclocInstance;
156 s_appmgrInstance = newInstance;
157 s_svclocInstance = s_appmgrInstance;
163 const std::string& factname,
164 const std::string& dllname)
179 ii = ObjFactory::create(factname, (
IInterface*)0);
181 is = Service::Factory::create(factname, name, (
ISvcLocator*)0);
183 ia = Algorithm::Factory::create(factname, name, (
ISvcLocator*)0);
191 std::cout <<
"Gaudi::Bootstrap: Not found DLL " << dllname << std::endl;
212 static std::list<IService*> s_bootServices;
218 BootSvcLocator::BootSvcLocator() {
223 #if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
228 if ( s_appmgrInstance.
isValid() ) {
229 sc = s_svclocInstance->
getService(typeName, iid, pinterface );
231 pinterface = s_bootInterface.
get();
237 const bool createIf ) {
239 if ( s_appmgrInstance.
isValid() ) {
240 sc = s_svclocInstance->
getService(typeName, svc, createIf );
242 svc = s_bootService.
get();
250 if ( s_appmgrInstance.
isValid() ) {
253 return s_bootServices;
258 if ( s_appmgrInstance.
isValid() ) {
266 if ( s_appmgrInstance.
isValid() ) {
267 return s_svclocInstance->
service(typeName, createIf);
269 return s_bootService;
274 #ifdef GAUDI_HASCLASSVISIBILITY
275 #pragma GCC visibility push(default)
279 #define PyHelper(x) py_bootstrap_ ## x
322 #define PyFSMHelper(s) bool py_bootstrap_fsm_ ## s (IInterface* i) { \
323 auto fsm = SmartIF<IStateful>(i); \
324 if (fsm) { return fsm-> s ().isSuccess(); } \
335 bool py_bootstrap_app_run(
IInterface*
i,
int maxevt) {
337 if (
ep) {
return ep->executeRun(maxevt).isSuccess(); }
341 #ifdef GAUDI_HASCLASSVISIBILITY
342 #pragma GCC visibility pop
int PyHelper() ROOT_VERSION_CODE()
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.
virtual bool existsService(const std::string &name) const
Check the existence of a service given a service name.
bool isSuccess() const
Test for a status code of SUCCESS.
virtual ~BootSvcLocator()
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)
bool isFailure() const
Test for a status code of FAILURE.
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
Returns a smart pointer to a service.
TYPE * get() const
Get interface pointer.
Gaudi::InterfaceId< IInterface, 0, 0 > iid
Interface ID.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Base class used to implement the interfaces.
virtual StatusCode getService(const Gaudi::Utils::TypeNameString &typeName, const InterfaceID &iid, IInterface *&pinterface)
Get a specific interface pointer given a service name and interface id.
Helper class to parse a string of format "type/name".
GAUDI_API ISvcLocator * svcLocator()
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)
SimpleProperty< std::string > StringProperty
The IAlgorithm is the interface implemented by the Algorithm base class.
virtual const std::list< IService * > & getServices() const
Get a reference to a service and create it if it does not exists.
Application Manager User Interface.
GAUDI_API ISvcLocator * setInstance(ISvcLocator *newInstance)
Set new instance of service locator.
virtual unsigned long release()=0
Release Interface instance.
bool isValid() const
Allow for check if smart pointer is valid.
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.
std::string typeName(const std::type_info &typ)
virtual StatusCode configure()=0
Configure the job.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
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)
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.