Python equivalent to the C++ Property interface
Definition at line 230 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 233 of file Bindings.py.
233 def __init__(self, name, ip=None):
235 self.__dict__[
'_ip'] = InterfaceCast(gbl.IProperty)(ip)
237 self.__dict__[
'_ip'] =
None 238 self.__dict__[
'_svcloc'] = gbl.Gaudi.svcLocator()
239 optsvc = Helper.service(self._svcloc,
'JobOptionsSvc')
241 self.__dict__[
'_optsvc'] = InterfaceCast(
242 gbl.IJobOptionsSvc)(optsvc)
244 self.__dict__[
'_optsvc'] =
None 245 self.__dict__[
'_name'] = name
◆ __call_interface_method__()
| def GaudiPython.Bindings.iProperty.__call_interface_method__ |
( |
|
self, |
|
|
|
ifname, |
|
|
|
method, |
|
|
* |
args |
|
) |
| |
Definition at line 255 of file Bindings.py.
255 def __call_interface_method__(self, ifname, method, *args):
256 if not getattr(self, ifname):
257 self.retrieveInterface()
258 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 316 of file Bindings.py.
316 def __getattr__(self, name):
318 The method which returns the value for the given property 319 - In the case of the valid instance it returns the valid property value through IProperty interface 320 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue 322 ip = self.getInterface()
324 if not gbl.Gaudi.Utils.hasProperty(ip, name):
325 raise AttributeError(
'property %s does not exist' % name)
326 prop = ip.getProperty(name)
327 if StringProperty ==
type(prop):
329 elif StringPropertyRef ==
type(prop):
332 return eval(prop.toString(), {}, {})
336 props = self._optsvc.getProperties(self._name)
338 if not p.name() == name:
342 return eval(p.value(), {}, {})
345 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 260 of file Bindings.py.
260 def __setattr__(self, name, value):
262 The method which is used for setting the property from the given value. 263 - In the case of the valid instance it sets the property through IProperty interface 264 - In the case of placeholder the property is added to JobOptionsCatalogue 266 if hasattr(value,
'toStringProperty'):
268 value =
'%s' % value.toStringProperty()
269 ip = self.getInterface()
271 if not gbl.Gaudi.Utils.hasProperty(ip, name):
272 raise AttributeError(
'property %s does not exist' % name)
273 prop = ip.getProperty(name)
276 canSetValue = (hasattr(prop,
'value')
277 and 'const&[' not in prop.value.func_doc
278 and type(value) ==
type(prop.value()))
280 canSetValue = (hasattr(prop,
'value')
281 and type(value) ==
type(prop.value()))
284 if not prop.setValue(value):
285 raise AttributeError(
286 'property %s could not be set from %s' % (name, value))
288 if tuple ==
type(value):
290 elif hasattr(value,
'toString'):
291 value = value.toString()
292 elif not long ==
type(value):
297 sc = cppyy.gbl.GaudiPython.Helper.setPropertyFromString(
300 sc = prop.fromString(value)
302 raise AttributeError(
303 'property %s could not be set from %s' % (name, value))
305 if type(value) == str:
306 value =
'"%s"' % value
307 elif type(value) == tuple:
309 elif hasattr(value,
'toString'):
310 value = value.toString()
311 elif type(value) == long:
313 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 247 of file Bindings.py.
247 def getInterface(self):
249 self.retrieveInterface()
◆ name()
| def GaudiPython.Bindings.iProperty.name |
( |
|
self | ) |
|
◆ properties()
| def GaudiPython.Bindings.iProperty.properties |
( |
|
self | ) |
|
Definition at line 347 of file Bindings.py.
350 ip = self.getInterface()
352 props = ip.getProperties()
353 propsFrom = self._name
355 props = self._optsvc.getProperties(self._name)
356 propsFrom =
"jobOptionsSvc" 360 dct[p.name()] = PropertyEntry(p)
361 except (ValueError, TypeError)
as e:
362 raise ValueError(
"gaudimodule.iProperty.properties(): %s%s processing property %s.%s = %s" % \
363 (e.__class__.__name__, e.args,
364 propsFrom, p.name(), p.value()))
◆ retrieveInterface()
| def GaudiPython.Bindings.iProperty.retrieveInterface |
( |
|
self | ) |
|
The documentation for this class was generated from the following file: