CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ntupleEnum._Enum Class Reference

Public Member Functions

def __init__ (self, **values)
 
def toString (self, val)
 

Private Attributes

 _reverse
 

Detailed Description

Definition at line 2 of file ntupleEnum.py.

Constructor & Destructor Documentation

◆ __init__()

def ntupleEnum._Enum.__init__ (   self,
**  values 
)

Definition at line 3 of file ntupleEnum.py.

3  def __init__(self, **values):
4  self._reverse = {}
5  for key, value in values.items():
6  setattr(self, key, value)
7  if value in self._reverse:
8  raise Exception("Value %s is already used for a key %s, tried to re-add it for key %s" % (value, self._reverse[value], key))
9  self._reverse[value] = key
10 

Member Function Documentation

◆ toString()

def ntupleEnum._Enum.toString (   self,
  val 
)

Definition at line 11 of file ntupleEnum.py.

11  def toString(self, val):
12  return self._reverse[val]
13 

References ntupleEnum._Enum._reverse.

Member Data Documentation

◆ _reverse

ntupleEnum._Enum._reverse
private

Definition at line 4 of file ntupleEnum.py.

Referenced by ntupleEnum._Enum.toString().

toolbox::toString
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
Exception