Python equivalent to the C++ Property interface
Definition at line 249 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 252 of file Bindings.py.
252 def __init__(self, name, ip=None):
254 self.__dict__[
'_ip'] = InterfaceCast(gbl.IProperty)(ip)
256 self.__dict__[
'_ip'] =
None 257 self.__dict__[
'_svcloc'] = gbl.Gaudi.svcLocator()
258 optsvc = Helper.service(self._svcloc,
'JobOptionsSvc')
260 self.__dict__[
'_optsvc'] = InterfaceCast(
261 gbl.IJobOptionsSvc)(optsvc)
263 self.__dict__[
'_optsvc'] =
None 264 self.__dict__[
'_name'] = name
◆ __call_interface_method__()
| def GaudiPython.Bindings.iProperty.__call_interface_method__ |
( |
|
self, |
|
|
|
ifname, |
|
|
|
method, |
|
|
* |
args |
|
) |
| |
Definition at line 274 of file Bindings.py.
274 def __call_interface_method__(self, ifname, method, *args):
275 if not getattr(self, ifname):
276 self.retrieveInterface()
277 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 335 of file Bindings.py.
335 def __getattr__(self, name):
337 The method which returns the value for the given property 338 - In the case of the valid instance it returns the valid property value through IProperty interface 339 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue 341 ip = self.getInterface()
343 if not gbl.Gaudi.Utils.hasProperty(ip, name):
344 raise AttributeError(
'property %s does not exist' % name)
345 prop = ip.getProperty(name)
346 if StringProperty ==
type(prop):
348 elif StringPropertyRef ==
type(prop):
351 return eval(prop.toString(), {}, {})
355 props = self._optsvc.getProperties(self._name)
357 if not p.name() == name:
361 return eval(p.value(), {}, {})
364 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 279 of file Bindings.py.
279 def __setattr__(self, name, value):
281 The method which is used for setting the property from the given value. 282 - In the case of the valid instance it sets the property through IProperty interface 283 - In the case of placeholder the property is added to JobOptionsCatalogue 285 if hasattr(value,
'toStringProperty'):
287 value =
'%s' % value.toStringProperty()
288 ip = self.getInterface()
290 if not gbl.Gaudi.Utils.hasProperty(ip, name):
291 raise AttributeError(
'property %s does not exist' % name)
292 prop = ip.getProperty(name)
295 canSetValue = (hasattr(prop,
'value')
296 and 'const&[' not in prop.value.func_doc
297 and type(value) ==
type(prop.value()))
299 canSetValue = (hasattr(prop,
'value')
300 and type(value) ==
type(prop.value()))
303 if not prop.setValue(value):
304 raise AttributeError(
305 'property %s could not be set from %s' % (name, value))
307 if tuple ==
type(value):
309 elif hasattr(value,
'toString'):
310 value = value.toString()
311 elif not long ==
type(value):
316 sc = cppyy.gbl.GaudiPython.Helper.setPropertyFromString(
319 sc = prop.fromString(value)
321 raise AttributeError(
322 'property %s could not be set from %s' % (name, value))
324 if type(value) == str:
325 value =
'"%s"' % value
326 elif type(value) == tuple:
328 elif hasattr(value,
'toString'):
329 value = value.toString()
330 elif type(value) == long:
332 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 266 of file Bindings.py.
266 def getInterface(self):
268 self.retrieveInterface()
◆ name()
| def GaudiPython.Bindings.iProperty.name |
( |
|
self | ) |
|
◆ properties()
| def GaudiPython.Bindings.iProperty.properties |
( |
|
self | ) |
|
Definition at line 366 of file Bindings.py.
369 ip = self.getInterface()
371 props = ip.getProperties()
372 propsFrom = self._name
374 props = self._optsvc.getProperties(self._name)
375 propsFrom =
"jobOptionsSvc" 379 dct[p.name()] = PropertyEntry(p)
380 except (ValueError, TypeError)
as e:
381 raise ValueError(
"gaudimodule.iProperty.properties(): %s%s processing property %s.%s = %s" % \
382 (e.__class__.__name__, e.args,
383 propsFrom, p.name(), p.value()))
◆ retrieveInterface()
| def GaudiPython.Bindings.iProperty.retrieveInterface |
( |
|
self | ) |
|
The documentation for this class was generated from the following file: