56 from ctypes
import PyDLL, c_void_p, c_bool, c_char_p, c_int
59 class IInterface_p(c_void_p):
61 return "IInterface_p(0x%x)" % (0
if self.value
is None 63 self.
log = logging.getLogger(
'BootstrapHelper')
65 libname =
'libGaudiKernel.so' 66 self.log.debug(
'loading GaudiKernel (%s)', libname)
70 self.
lib = gkl = PyDLL(libname)
72 functions = [(
'createApplicationMgr', IInterface_p, []),
73 (
'getService', IInterface_p, [IInterface_p, c_char_p]),
74 (
'setProperty', c_bool, [IInterface_p, c_char_p, c_char_p]),
75 (
'getProperty', c_char_p, [IInterface_p, c_char_p]),
76 (
'addPropertyToCatalogue', c_bool, [IInterface_p, c_char_p, c_char_p, c_char_p]),
77 (
'ROOT_VERSION_CODE', c_int, []),
80 for name, restype, argtypes
in functions:
81 f = getattr(gkl,
'py_bootstrap_%s' % name)
82 f.restype, f.argtypes = restype, argtypes
85 if name
not in self.__class__.__dict__:
86 setattr(self, name, f)
88 for name
in (
'configure',
'initialize',
'start',
89 'stop',
'finalize',
'terminate'):
90 f = getattr(gkl,
'py_bootstrap_fsm_%s' % name)
91 f.restype, f.argtypes = c_bool, [IInterface_p]
92 gkl.py_bootstrap_app_run.restype = c_bool
93 gkl.py_bootstrap_app_run.argtypes = [IInterface_p, c_int]
95 gkl.py_helper_printAlgsSequences.restype =
None 96 gkl.py_helper_printAlgsSequences.argtypes = [IInterface_p]