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 _resetWrapper
 Private member functions ##. More...
 
def _setStatus
 
def _typeInfoGetter
 

Private Attributes

 _exception
 
 _nodel
 
 _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._nodel = False
61  if kwargs.get ('noDelete'):
62  print "Not deleting wrapper"
63  del kwargs['noDelete']
64  else:
65  self._nodel = True
66  self._type = typeString
68  self._exception = RuntimeError ("getByLabel not called for '%s'", self)
69  # restore warning state
70  ROOT.gErrorIgnoreLevel = oldWarningLevel
71  # Since we deleted the options as we used them, that means
72  # that kwargs should be empty. If it's not, that means that
73  # somebody passed in an argument that we're not using and we
74  # should complain.
75  if len (kwargs):
76  raise RuntimeError("Unknown arguments %s" % kwargs)
def _resetWrapper
Private member functions ##.
Definition: __init__.py:96

Member Function Documentation

def python.Handle.__str__ (   self)

Definition at line 90 of file __init__.py.

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

Referenced by BeautifulSoup.Tag.__repr__(), BeautifulSoup.Tag.__unicode__(), and BeautifulSoup.Tag.prettify().

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

Definition at line 113 of file __init__.py.

References python.Handle._wrapper.

114  def _addressOf (self):
115  """(Internal) Return address of edm wrapper"""
116  return ROOT.AddressOf (self._wrapper)
117 
def _addressOf
Definition: __init__.py:113
def python.Handle._resetWrapper (   self)
private

Private member functions ##.

(Internal) reset the edm wrapper

Definition at line 96 of file __init__.py.

96 
97  def _resetWrapper (self):
98  """(Internal) reset the edm wrapper"""
99  self._wrapper = ROOT.edm.Wrapper (self._type)()
100  self._typeInfo = self._wrapper.typeInfo()
101  ROOT.SetOwnership (self._wrapper, False)
102  # O.k. This is a little weird. We want a pointer to an EDM
103  # wrapper, but we don't want the memory it is pointing to.
104  # So, we've created it and grabbed the type info. Since we
105  # don't want a memory leak, we destroy it.
106  if not self._nodel :
107  ROOT.TClass.GetClass("edm::Wrapper<"+self._type+">").Destructor( self._wrapper )
def _resetWrapper
Private member functions ##.
Definition: __init__.py:96
def python.Handle._setStatus (   self,
  getByLabelSuccess,
  labelString 
)
private
(Internal) To be called by Events.getByLabel

Definition at line 118 of file __init__.py.

References python.Handle._exception.

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

Definition at line 108 of file __init__.py.

References python.Handle._typeInfo.

109  def _typeInfoGetter (self):
110  """(Internal) Return the type info"""
111  return self._typeInfo
112 
def _typeInfoGetter
Definition: __init__.py:108
def python.Handle.isValid (   self)
Returns true if getByLabel call was successful and data is
present in handle.

Definition at line 77 of file __init__.py.

References python.Handle._exception.

Referenced by core.AutoHandle.AutoHandle.ReallyLoad().

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

Definition at line 83 of file __init__.py.

References python.Handle._exception.

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

Member Data Documentation

python.Handle._exception
private

Definition at line 67 of file __init__.py.

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

python.Handle._nodel
private

Definition at line 59 of file __init__.py.

python.Handle._type
private

Definition at line 65 of file __init__.py.

Referenced by python.Handle.__str__(), cfg-viewer.unscheduled._proceed(), Vispa.Gui.PortConnection.PointToPointConnection.calculateRoute(), and SequenceTypes.ExpandVisitor.result().

python.Handle._typeInfo
private

Definition at line 99 of file __init__.py.

Referenced by python.Handle._typeInfoGetter().

python.Handle._wrapper
private

Definition at line 98 of file __init__.py.

Referenced by python.Handle._addressOf().