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  self._type = typeString
58  self._wrapper = ROOT.edm.Wrapper (self._type)()
59  self._typeInfo = self._wrapper.typeInfo()
60  self._exception = RuntimeError ("getByLabel not called for '%s'", self)
61  global options
62  ROOT.SetOwnership (self._wrapper, False)
63  # O.k. This is a little weird. We want a pointer to an EDM
64  # wrapper, but we don't want the memory it is pointing to.
65  # So, we've created it and grabbed the type info. Since we
66  # don't want a memory leak, we destroy it.
67  if kwargs.get ('noDelete'):
68  print "Not deleting wrapper"
69  del kwargs['noDelete']
70  else:
71  self._wrapper.IsA().Destructor( self._wrapper )
72  # Since we deleted the options as we used them, that means
73  # that kwargs should be empty. If it's not, that means that
74  # somebody passed in an argument that we're not using and we
75  # should complain.
76  if len (kwargs):
77  raise RuntimeError, "Unknown arguments %s" % kwargs
78 

Member Function Documentation

def python.Handle.__str__ (   self)

Definition at line 92 of file __init__.py.

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

92 
93  def __str__ (self):
94  return "%s" % (self._type)
95 
def python.Handle._addressOf (   self)
private
(Internal) Return address of edm wrapper

Definition at line 103 of file __init__.py.

References python.Handle._wrapper.

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

Definition at line 108 of file __init__.py.

References python.Handle._exception.

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

Private member functions ##.

(Internal) Return the type info

Definition at line 98 of file __init__.py.

References python.Handle._typeInfo.

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

Definition at line 79 of file __init__.py.

References python.Handle._exception.

79 
80  def isValid (self):
81  """Returns true if getByLabel call was successful and data is
82  present in handle."""
83  return not self._exception
84 
def python.Handle.product (   self)
Returns product stored in handle.

Definition at line 85 of file __init__.py.

References python.Handle._exception.

85 
86  def product (self):
87  """Returns product stored in handle."""
88  if self._exception:
89  raise self._exception
90  return self._wrapper.product()
91 

Member Data Documentation

python.Handle._exception
private

Definition at line 59 of file __init__.py.

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

python.Handle._type
private

Definition at line 56 of file __init__.py.

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

python.Handle._typeInfo
private

Definition at line 58 of file __init__.py.

Referenced by python.Handle._typeInfoGetter().

python.Handle._wrapper
private

Definition at line 57 of file __init__.py.

Referenced by python.Handle._addressOf().