The Gaudi Framework  master (37c0b60a)
Bootstrap.cpp File Reference
#include <iostream>
#include <GaudiKernel/Bootstrap.h>
#include <GaudiKernel/System.h>
#include <GaudiKernel/IAlgorithm.h>
#include <GaudiKernel/IAppMgrUI.h>
#include <GaudiKernel/IClassManager.h>
#include <GaudiKernel/IInterface.h>
#include <GaudiKernel/IService.h>
#include <GaudiKernel/ISvcLocator.h>
#include <Gaudi/Algorithm.h>
#include <GaudiKernel/ObjectFactory.h>
#include <GaudiKernel/Service.h>
#include <GaudiKernel/IEventProcessor.h>
#include <RVersion.h>
#include <Python.h>
Include dependency graph for Bootstrap.cpp:

Go to the source code of this file.

Classes

class  Gaudi::BootSvcLocator
 

Namespaces

 Gaudi
 This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from python with a format liks : ( nbins, min, max, title ) where title can be ommited.
 

Macros

#define PyHelper(x)   py_bootstrap_##x
 
#define PyFSMHelper(s)
 

Functions

IInterface *PyHelper() createApplicationMgr ()
 
IInterface *PyHelper() getService (IInterface *app, char *name)
 
bool PyHelper() setProperty (IInterface *p, char *name, char *value)
 
const char *PyHelper() getProperty (IInterface *p, char *name)
 
void PyHelper() setOption (IInterface *app, char *key, char *value)
 
bool PyHelper() configureApp (IInterface *app)
 
int PyHelper() ROOT_VERSION_CODE ()
 
bool py_bootstrap_app_run (IInterface *i, int maxevt)
 

Macro Definition Documentation

◆ PyFSMHelper

#define PyFSMHelper (   s)
Value:
bool py_bootstrap_fsm_##s( IInterface* i ) { \
auto fsm = SmartIF<IStateful>( i ); \
return fsm && fsm->s().isSuccess(); \
}

Definition at line 279 of file Bootstrap.cpp.

◆ PyHelper

#define PyHelper (   x)    py_bootstrap_##x

Definition at line 242 of file Bootstrap.cpp.

Function Documentation

◆ configureApp()

bool PyHelper() configureApp ( IInterface app)

Definition at line 262 of file Bootstrap.cpp.

262  {
263  auto ui = SmartIF<IAppMgrUI>( app );
264  return ui && ui->configure().isSuccess();
265 }

◆ createApplicationMgr()

IInterface* PyHelper() createApplicationMgr ( )

Definition at line 242 of file Bootstrap.cpp.

242 { return Gaudi::createApplicationMgr(); }

◆ getProperty()

const char* PyHelper() getProperty ( IInterface p,
char *  name 
)

Definition at line 251 of file Bootstrap.cpp.

251  {
252  auto prop = SmartIF<IProperty>( p );
253  if ( !prop ) return nullptr;
254  // this is needed to guarantee that Python can access the returned char*
255  static std::string value;
256  value = prop->getProperty( name ).toString();
257  return value.c_str();
258 }

◆ getService()

IInterface* PyHelper() getService ( IInterface app,
char *  name 
)

Definition at line 243 of file Bootstrap.cpp.

243  {
244  auto svcloc = SmartIF<ISvcLocator>( app );
245  return svcloc ? svcloc->service<IInterface>( std::string_view{ name } ).get() : nullptr;
246 }

◆ py_bootstrap_app_run()

bool py_bootstrap_app_run ( IInterface i,
int  maxevt 
)

Definition at line 268 of file Bootstrap.cpp.

268  {
269  auto ep = SmartIF<IEventProcessor>( i );
270  bool stat = false;
271  // Relinquish the GIL to allow python algs in MT mode
272  Py_BEGIN_ALLOW_THREADS;
273  stat = ep && ep->executeRun( maxevt ).isSuccess();
274  Py_END_ALLOW_THREADS;
275  return stat;
276 }

◆ ROOT_VERSION_CODE()

int PyHelper() ROOT_VERSION_CODE ( )

Definition at line 266 of file Bootstrap.cpp.

266 { return ROOT_VERSION_CODE; }

◆ setOption()

void PyHelper() setOption ( IInterface app,
char *  key,
char *  value 
)

Definition at line 259 of file Bootstrap.cpp.

259  {
260  if ( auto svcloc = SmartIF<ISvcLocator>( app ) ) { svcloc->getOptsSvc().set( key, value ); }
261 }

◆ setProperty()

bool PyHelper() setProperty ( IInterface p,
char *  name,
char *  value 
)

Definition at line 247 of file Bootstrap.cpp.

247  {
248  auto prop = SmartIF<IProperty>( p );
249  return prop && prop->setProperty( name, value ).isSuccess();
250 }
Gaudi::createApplicationMgr
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)
std::string
STL class.
Read.app
app
Definition: Read.py:36
gaudirun.s
string s
Definition: gaudirun.py:346
GaudiPartProp.decorators.get
get
decorate the vector of properties
Definition: decorators.py:283
std::string::c_str
T c_str(T... args)
GaudiPython.Bindings.nullptr
nullptr
Definition: Bindings.py:87
SmartIF< IStateful >
ROOT_VERSION_CODE
int PyHelper() ROOT_VERSION_CODE()
Definition: Bootstrap.cpp:266
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
IInterface
Definition: IInterface.h:239
ProduceConsume.key
key
Definition: ProduceConsume.py:84