The Gaudi Framework  v33r0 (d5ea422b)
DataObjectHandleBase.py
Go to the documentation of this file.
1 
11 __doc__ = """The python module holding python bindings to DataObjectHandle"""
12 
13 # s = "/Path/to/Address"
14 
15 
16 class DataObjectHandleBase(object):
17 
18  __slots__ = ('Path', 'Mode', 'Type')
19 
20  # define accessTypes
21 
22  def __init__(self, path, mode='R', _type="unknown_t"):
23  object.__init__(self)
24  self.Path = path
25  self.Mode = mode
26  self.Type = _type
27 
28  def __getstate__(self):
29  return {'Path': self.Path}
30 
31  def __setstate__(self, state):
32  self.Path = state['Path']
33 
34  def __eq__(self, other):
35  """
36  Need especially Configurable.isPropertySet when checked against default.
37  """
38  if isinstance(other, DataObjectHandleBase):
39  return self.Path == other.Path
40  if isinstance(other, str):
41  return self.Path == other
42  if other is None:
43  return False
44  raise ValueError(
45  'Unknown equality check: type=%r, repr=%r' % (type(other), other))
46 
47  def __ne__(self, other):
48  """
49  This is mandatory if __eq__ is defined.
50  """
51  return not self == other
52 
53  def __str__(self):
54  return self.Path
55 
56  def __repr__(self):
57  return "%s(\"%s\")" % (self.__class__.__name__, self.__str__())
58 
59  def toStringProperty(self):
60  return self.__str__()
61 
62  def __add__(self, other):
63  path = ':'.join(i + other for i in self.Path.split(':'))
64  return DataObjectHandleBase(path, self.Mode, self.Type)
65 
66  def __radd__(self, other):
67  path = ':'.join(other + i for i in self.Path.split(':'))
68  return DataObjectHandleBase(path, self.Mode, self.Type)
69 
70  def __iadd__(self, other):
71  self.Path = ':'.join(i + other for i in self.Path.split(':'))
72  return self
73 
74  def mode(self):
75  return self.Mode
76 
77  def type(self):
78  return self.Type
79 
80  def __opt_value__(self):
81  return repr(str(self))
def __init__(self, path, mode='R', _type="unknown_t")