The Gaudi Framework  v30r4 (9b837755)
DataHandle.py
Go to the documentation of this file.
1 __version__ = "$Revision: 0.1 $"
2 __doc__ = """The python module holding python bindings to DataHandle"""
3 
4 
5 class DataHandle(object):
6  __slots__ = ('Path', '_whiteboard', '_access')
7 
8  # Access mode for DataHandles
9  class AccessMode:
10  class Read:
11  pass
12 
13  class Write:
14  pass
15 
16  # The default values allow PropertyProxy's _isCompatible check to pass when
17  # a DataHandle is set from a path string.
18  def __init__(self, path, whiteboard=None, access=None):
19  object.__init__(self)
20  self.Path = path
21  self._whiteboard = whiteboard
22  self._access = access
23 
24  def __eq__(self, other):
25  if isinstance(other, DataHandle):
26  return ((self.Path == other.Path) and
27  (self._whiteboard == other._whiteboard) and
28  (self._access == other._access))
29  if isinstance(other, basestring):
30  return self.Path == other
31  if other is None:
32  return False
33  raise ValueError('Unknown equality check: type=%r, repr=%r' %
34  (type(other), other))
35 
36  def __ne__(self, other):
37  """
38  This is mandatory if __eq__ is defined.
39  """
40  return not self == other
41 
42  def __str__(self):
43  return self.Path
44 
45  def __repr__(self):
46  return "%s(\"path=%s, whiteboard=%s, access=%s\")" % (
47  self.__class__.__name__,
48  self.Path,
49  self._whiteboard,
50  self._access.__class__.__name__)
51 
52  def toStringProperty(self):
53  return self.__str__()
54 
55  def __add__(self, other):
56  path = ':'.join(i + other for i in self.Path.split(':'))
57  return DataObjectHandleBase(path)
58 
59  def __radd__(self, other):
60  path = ':'.join(other + i for i in self.Path.split(':'))
61  return DataObjectHandleBase(path)
62 
63  def __iadd__(self, other):
64  self.Path = ':'.join(i + other for i in self.Path.split(':'))
65  return self
66 
67  def whiteboard(self):
68  return self._whiteboard
69 
70  def access(self):
71  return self._access
def __init__(self, path, whiteboard=None, access=None)
Definition: DataHandle.py:18
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.