The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 243 of file Bootstrap.cpp.

◆ PyHelper

#define PyHelper (   x)    py_bootstrap_##x

Definition at line 206 of file Bootstrap.cpp.

Function Documentation

◆ configureApp()

bool PyHelper() configureApp ( IInterface app)

Definition at line 226 of file Bootstrap.cpp.

226  {
227  auto ui = SmartIF<IAppMgrUI>( app );
228  return ui && ui->configure().isSuccess();
229 }

◆ createApplicationMgr()

IInterface* PyHelper() createApplicationMgr ( )

Definition at line 206 of file Bootstrap.cpp.

206 { return Gaudi::createApplicationMgr(); }

◆ getProperty()

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

Definition at line 215 of file Bootstrap.cpp.

215  {
216  auto prop = SmartIF<IProperty>( p );
217  if ( !prop ) return nullptr;
218  // this is needed to guarantee that Python can access the returned char*
219  static std::string value;
220  value = prop->getProperty( name ).toString();
221  return value.c_str();
222 }

◆ getService()

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

Definition at line 207 of file Bootstrap.cpp.

207  {
208  auto svcloc = SmartIF<ISvcLocator>( app );
209  return svcloc ? svcloc->service<IInterface>( std::string_view{ name } ).get() : nullptr;
210 }

◆ py_bootstrap_app_run()

bool py_bootstrap_app_run ( IInterface i,
int  maxevt 
)

Definition at line 232 of file Bootstrap.cpp.

232  {
233  auto ep = SmartIF<IEventProcessor>( i );
234  bool stat = false;
235  // Relinquish the GIL to allow python algs in MT mode
236  Py_BEGIN_ALLOW_THREADS;
237  stat = ep && ep->executeRun( maxevt ).isSuccess();
238  Py_END_ALLOW_THREADS;
239  return stat;
240 }

◆ ROOT_VERSION_CODE()

int PyHelper() ROOT_VERSION_CODE ( )

Definition at line 230 of file Bootstrap.cpp.

230 { return ROOT_VERSION_CODE; }

◆ setOption()

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

Definition at line 223 of file Bootstrap.cpp.

223  {
224  if ( auto svcloc = SmartIF<ISvcLocator>( app ) ) { svcloc->getOptsSvc().set( key, value ); }
225 }

◆ setProperty()

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

Definition at line 211 of file Bootstrap.cpp.

211  {
212  auto prop = SmartIF<IProperty>( p );
213  return prop && prop->setProperty( name, value ).isSuccess();
214 }
Gaudi::createApplicationMgr
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)
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
GaudiPython.Bindings.nullptr
nullptr
Definition: Bindings.py:87
SmartIF< IStateful >
ROOT_VERSION_CODE
int PyHelper() ROOT_VERSION_CODE()
Definition: Bootstrap.cpp:230
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
IInterface
Definition: IInterface.h:225
ProduceConsume.key
key
Definition: ProduceConsume.py:84