Python equivalent to the C++ Property interface
Definition at line 258 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 261 of file Bindings.py.
261 def __init__(self, name, ip=None):
263 self.__dict__[
'_ip'] = InterfaceCast(gbl.IProperty)(ip)
265 self.__dict__[
'_ip'] =
None 266 self.__dict__[
'_svcloc'] = gbl.Gaudi.svcLocator()
267 optsvc = Helper.service(self._svcloc,
'JobOptionsSvc')
269 self.__dict__[
'_optsvc'] = InterfaceCast(
270 gbl.IJobOptionsSvc)(optsvc)
272 self.__dict__[
'_optsvc'] =
None 273 self.__dict__[
'_name'] = name
◆ __call_interface_method__()
| def GaudiPython.Bindings.iProperty.__call_interface_method__ |
( |
|
self, |
|
|
|
ifname, |
|
|
|
method, |
|
|
* |
args |
|
) |
| |
Definition at line 283 of file Bindings.py.
283 def __call_interface_method__(self, ifname, method, *args):
284 if not getattr(self, ifname):
285 self.retrieveInterface()
286 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 344 of file Bindings.py.
344 def __getattr__(self, name):
346 The method which returns the value for the given property 347 - In the case of the valid instance it returns the valid property value through IProperty interface 348 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue 350 ip = self.getInterface()
352 if not gbl.Gaudi.Utils.hasProperty(ip, name):
353 raise AttributeError(
'property %s does not exist' % name)
354 prop = ip.getProperty(name)
355 if StringProperty ==
type(prop):
357 elif StringPropertyRef ==
type(prop):
360 return eval(prop.toString(), {}, {})
364 props = self._optsvc.getProperties(self._name)
366 if not p.name() == name:
370 return eval(p.value(), {}, {})
373 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 288 of file Bindings.py.
288 def __setattr__(self, name, value):
290 The method which is used for setting the property from the given value. 291 - In the case of the valid instance it sets the property through IProperty interface 292 - In the case of placeholder the property is added to JobOptionsCatalogue 294 if hasattr(value,
'toStringProperty'):
296 value =
'%s' % value.toStringProperty()
297 ip = self.getInterface()
299 if not gbl.Gaudi.Utils.hasProperty(ip, name):
300 raise AttributeError(
'property %s does not exist' % name)
301 prop = ip.getProperty(name)
304 canSetValue = (hasattr(prop,
'value')
305 and 'const&[' not in prop.value.func_doc
306 and type(value) ==
type(prop.value()))
308 canSetValue = (hasattr(prop,
'value')
309 and type(value) ==
type(prop.value()))
312 if not prop.setValue(value):
313 raise AttributeError(
314 'property %s could not be set from %s' % (name, value))
316 if tuple ==
type(value):
318 elif hasattr(value,
'toString'):
319 value = value.toString()
320 elif not long ==
type(value):
325 sc = cppyy.gbl.GaudiPython.Helper.setPropertyFromString(
328 sc = prop.fromString(value)
330 raise AttributeError(
331 'property %s could not be set from %s' % (name, value))
333 if type(value) == str:
334 value =
'"%s"' % value
335 elif type(value) == tuple:
337 elif hasattr(value,
'toString'):
338 value = value.toString()
339 elif type(value) == long:
341 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 275 of file Bindings.py.
275 def getInterface(self):
277 self.retrieveInterface()
◆ name()
| def GaudiPython.Bindings.iProperty.name |
( |
|
self | ) |
|
◆ properties()
| def GaudiPython.Bindings.iProperty.properties |
( |
|
self | ) |
|
Definition at line 375 of file Bindings.py.
378 ip = self.getInterface()
380 props = ip.getProperties()
381 propsFrom = self._name
383 props = self._optsvc.getProperties(self._name)
384 propsFrom =
"jobOptionsSvc" 388 dct[p.name()] = PropertyEntry(p)
389 except (ValueError, TypeError)
as e:
390 raise ValueError(
"gaudimodule.iProperty.properties(): %s%s processing property %s.%s = %s" % \
391 (e.__class__.__name__, e.args,
392 propsFrom, p.name(), p.value()))
◆ retrieveInterface()
| def GaudiPython.Bindings.iProperty.retrieveInterface |
( |
|
self | ) |
|
The documentation for this class was generated from the following file: