Python equivalent to the C++ Property interface
Definition at line 248 of file Bindings.py.
◆ __init__()
| def GaudiPython.Bindings.iProperty.__init__ |
( |
|
self, |
|
|
|
name, |
|
|
|
ip = None |
|
) |
| |
Reimplemented in GaudiPython.Bindings.iJobOptSvc, GaudiPython.Bindings.iToolSvc, GaudiPython.Bindings.iNTupleSvc, GaudiPython.Bindings.iHistogramSvc, GaudiPython.Bindings.iDataSvc, GaudiPython.Bindings.iAlgTool, GaudiPython.Bindings.iAlgorithm, and GaudiPython.Bindings.iService.
Definition at line 251 of file Bindings.py.
251 def __init__(self, name, ip=None):
253 self.__dict__[
'_ip'] = InterfaceCast(gbl.IProperty)(ip)
255 self.__dict__[
'_ip'] =
None 256 self.__dict__[
'_svcloc'] = gbl.Gaudi.svcLocator()
257 optsvc = Helper.service(self._svcloc,
'JobOptionsSvc')
259 self.__dict__[
'_optsvc'] = InterfaceCast(
260 gbl.IJobOptionsSvc)(optsvc)
262 self.__dict__[
'_optsvc'] =
None 263 self.__dict__[
'_name'] = name
◆ __call_interface_method__()
| def GaudiPython.Bindings.iProperty.__call_interface_method__ |
( |
|
self, |
|
|
|
ifname, |
|
|
|
method, |
|
|
* |
args |
|
) |
| |
Definition at line 273 of file Bindings.py.
273 def __call_interface_method__(self, ifname, method, *args):
274 if not getattr(self, ifname):
275 self.retrieveInterface()
276 return getattr(getattr(self, ifname), method)(*args)
◆ __getattr__()
| def GaudiPython.Bindings.iProperty.__getattr__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
The method which returns the value for the given property
- In the case of the valid instance it returns the valid property value through IProperty interface
- In the case of placeholder the property value is retrieved from JobOptionsCatalogue
Definition at line 334 of file Bindings.py.
334 def __getattr__(self, name):
336 The method which returns the value for the given property 337 - In the case of the valid instance it returns the valid property value through IProperty interface 338 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue 340 ip = self.getInterface()
342 if not gbl.Gaudi.Utils.hasProperty(ip, name):
343 raise AttributeError(
'property %s does not exist' % name)
344 prop = ip.getProperty(name)
345 if StringProperty ==
type(prop):
347 elif StringPropertyRef ==
type(prop):
350 return eval(prop.toString(), {}, {})
354 props = self._optsvc.getProperties(self._name)
356 if not p.name() == name:
360 return eval(p.value(), {}, {})
363 raise AttributeError(
'property %s does not exist' % name)
◆ __setattr__()
| def GaudiPython.Bindings.iProperty.__setattr__ |
( |
|
self, |
|
|
|
name, |
|
|
|
value |
|
) |
| |
The method which is used for setting the property from the given value.
- In the case of the valid instance it sets the property through IProperty interface
- In the case of placeholder the property is added to JobOptionsCatalogue
Definition at line 278 of file Bindings.py.
278 def __setattr__(self, name, value):
280 The method which is used for setting the property from the given value. 281 - In the case of the valid instance it sets the property through IProperty interface 282 - In the case of placeholder the property is added to JobOptionsCatalogue 284 if hasattr(value,
'toStringProperty'):
286 value =
'%s' % value.toStringProperty()
287 ip = self.getInterface()
289 if not gbl.Gaudi.Utils.hasProperty(ip, name):
290 raise AttributeError(
'property %s does not exist' % name)
291 prop = ip.getProperty(name)
294 canSetValue = (hasattr(prop,
'value')
295 and 'const&[' not in prop.value.func_doc
296 and type(value) ==
type(prop.value()))
298 canSetValue = (hasattr(prop,
'value')
299 and type(value) ==
type(prop.value()))
302 if not prop.setValue(value):
303 raise AttributeError(
304 'property %s could not be set from %s' % (name, value))
306 if tuple ==
type(value):
308 elif hasattr(value,
'toString'):
309 value = value.toString()
310 elif not long ==
type(value):
315 sc = cppyy.gbl.GaudiPython.Helper.setPropertyFromString(
318 sc = prop.fromString(value)
320 raise AttributeError(
321 'property %s could not be set from %s' % (name, value))
323 if type(value) == str:
324 value =
'"%s"' % value
325 elif type(value) == tuple:
327 elif hasattr(value,
'toString'):
328 value = value.toString()
329 elif type(value) == long:
331 sp = gbl.GaudiPython.Helpers.mkStringProperty(name, str(value))
bool PyHelper() addPropertyToCatalogue(IInterface *p, char *comp, char *name, char *value)
def ROOT6WorkAroundEnabled(id=None)
◆ getInterface()
| def GaudiPython.Bindings.iProperty.getInterface |
( |
|
self | ) |
|
Definition at line 265 of file Bindings.py.
265 def getInterface(self):
267 self.retrieveInterface()
◆ name()
| def GaudiPython.Bindings.iProperty.name |
( |
|
self | ) |
|
◆ properties()
| def GaudiPython.Bindings.iProperty.properties |
( |
|
self | ) |
|
Definition at line 365 of file Bindings.py.
368 ip = self.getInterface()
370 props = ip.getProperties()
371 propsFrom = self._name
373 props = self._optsvc.getProperties(self._name)
374 propsFrom =
"jobOptionsSvc" 378 dct[p.name()] = PropertyEntry(p)
379 except (ValueError, TypeError)
as e:
380 raise ValueError(
"gaudimodule.iProperty.properties(): %s%s processing property %s.%s = %s" % \
381 (e.__class__.__name__, e.args,
382 propsFrom, p.name(), p.value()))
◆ retrieveInterface()
| def GaudiPython.Bindings.iProperty.retrieveInterface |
( |
|
self | ) |
|
The documentation for this class was generated from the following file: