CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
python.Handle Class Reference

## Handle

More...

Public Member Functions

def __init__
 
def __str__
 
def isValid
 
def product
 

Private Member Functions

def _addressOf
 
def _setStatus
 
def _typeInfoGetter
 Private member functions ##. More...
 

Private Attributes

 _exception
 
 _type
 
 _typeInfo
 
 _wrapper
 

Detailed Description

## Handle

Python interface to FWLite Handle class

Definition at line 49 of file __init__.py.

Constructor & Destructor Documentation

def python.Handle.__init__ (   self,
  typeString,
  kwargs 
)
Initialize python handle wrapper 

Definition at line 54 of file __init__.py.

54 
55  **kwargs):
56  """Initialize python handle wrapper """
57  # turn off warnings
58  oldWarningLevel = ROOT.gErrorIgnoreLevel
59  ROOT.gErrorIgnoreLevel = ROOT.kError
60  self._type = typeString
61  self._wrapper = ROOT.edm.Wrapper (self._type)()
62  self._typeInfo = self._wrapper.typeInfo()
63  self._exception = RuntimeError ("getByLabel not called for '%s'", self)
64  ROOT.SetOwnership (self._wrapper, False)
65  # restore warning state
66  ROOT.gErrorIgnoreLevel = oldWarningLevel
67  # O.k. This is a little weird. We want a pointer to an EDM
68  # wrapper, but we don't want the memory it is pointing to.
69  # So, we've created it and grabbed the type info. Since we
70  # don't want a memory leak, we destroy it.
71  if kwargs.get ('noDelete'):
72  print "Not deleting wrapper"
73  del kwargs['noDelete']
74  else:
75  self._wrapper.IsA().Destructor( self._wrapper )
76  # Since we deleted the options as we used them, that means
77  # that kwargs should be empty. If it's not, that means that
78  # somebody passed in an argument that we're not using and we
79  # should complain.
80  if len (kwargs):
81  raise RuntimeError, "Unknown arguments %s" % kwargs
82 

Member Function Documentation

def python.Handle.__str__ (   self)

Definition at line 96 of file __init__.py.

References PGeometricDet::Item._type, python.Handle._type, MELaserPrim._type, and TrackerGeometryCompare._type.

96 
97  def __str__ (self):
98  return "%s" % (self._type)
99 
def python.Handle._addressOf (   self)
private
(Internal) Return address of edm wrapper

Definition at line 107 of file __init__.py.

References python.Handle._wrapper.

108  def _addressOf (self):
109  """(Internal) Return address of edm wrapper"""
110  return ROOT.AddressOf (self._wrapper)
111 
def _addressOf
Definition: __init__.py:107
def python.Handle._setStatus (   self,
  getByLabelSuccess,
  labelString 
)
private
(Internal) To be called by Events.getByLabel

Definition at line 112 of file __init__.py.

References python.Handle._exception.

113  def _setStatus (self, getByLabelSuccess, labelString):
114  """(Internal) To be called by Events.getByLabel"""
115  if not getByLabelSuccess:
116  self._exception = RuntimeError ("getByLabel (%s, %s) failed" \
117  % (self, labelString))
118  return
119  if not self._wrapper.isPresent():
120  self._exception = RuntimeError ("getByLabel (%s, %s) not present this event" \
121  % (self, labelString))
122  return
123  # if we're still here, then everything is happy. Clear the exception
124  self._exception = None
125 
def _setStatus
Definition: __init__.py:112
def python.Handle._typeInfoGetter (   self)
private

Private member functions ##.

(Internal) Return the type info

Definition at line 102 of file __init__.py.

References python.Handle._typeInfo.

103  def _typeInfoGetter (self):
104  """(Internal) Return the type info"""
105  return self._typeInfo
106 
def _typeInfoGetter
Private member functions ##.
Definition: __init__.py:102
def python.Handle.isValid (   self)
Returns true if getByLabel call was successful and data is
present in handle.

Definition at line 83 of file __init__.py.

References python.Handle._exception.

83 
84  def isValid (self):
85  """Returns true if getByLabel call was successful and data is
86  present in handle."""
87  return not self._exception
88 
def python.Handle.product (   self)
Returns product stored in handle.

Definition at line 89 of file __init__.py.

References python.Handle._exception.

89 
90  def product (self):
91  """Returns product stored in handle."""
92  if self._exception:
93  raise self._exception
94  return self._wrapper.product()
95 

Member Data Documentation

python.Handle._exception
private

Definition at line 62 of file __init__.py.

Referenced by python.Handle._setStatus(), python.Handle.isValid(), and python.Handle.product().

python.Handle._type
private

Definition at line 59 of file __init__.py.

Referenced by python.Handle.__str__(), Vispa.Gui.PortConnection.PointToPointConnection.calculateRoute(), and SequenceTypes.ExpandVisitor.result().

python.Handle._typeInfo
private

Definition at line 61 of file __init__.py.

Referenced by python.Handle._typeInfoGetter().

python.Handle._wrapper
private

Definition at line 60 of file __init__.py.

Referenced by python.Handle._addressOf().