CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
StringToEnumParser< T > Class Template Reference

#include <HcalTopologyMode.h>

Public Member Functions

T parseString (const std::string &value)
 
template<>
 StringToEnumParser ()
 
template<>
 StringToEnumParser ()
 
 StringToEnumParser (void)
 

Private Attributes

std::map< std::string, TenumMap
 

Detailed Description

template<typename T>
class StringToEnumParser< T >

Definition at line 10 of file HcalTopologyMode.h.

Constructor & Destructor Documentation

◆ StringToEnumParser() [1/3]

template<typename T>
StringToEnumParser< T >::StringToEnumParser ( void  )

◆ StringToEnumParser() [2/3]

Definition at line 4 of file HcalTopologyMode.cc.

References HcalTopologyMode::H2, HcalTopologyMode::H2HE, HcalTopologyMode::LHC, and HcalTopologyMode::SLHC.

4  {
5  enumMap["HcalTopologyMode::LHC"] = HcalTopologyMode::LHC;
6  enumMap["HcalTopologyMode::H2"] = HcalTopologyMode::H2;
7  enumMap["HcalTopologyMode::SLHC"] = HcalTopologyMode::SLHC;
8  enumMap["HcalTopologyMode::H2HE"] = HcalTopologyMode::H2HE;
9 }
std::map< std::string, T > enumMap

◆ StringToEnumParser() [3/3]

Member Function Documentation

◆ parseString()

template<typename T>
T StringToEnumParser< T >::parseString ( const std::string &  value)
inline

Definition at line 16 of file HcalTopologyMode.h.

References StringToEnumParser< T >::enumMap.

16  {
17  typename std::map<std::string, T>::const_iterator iValue = enumMap.find(value);
18  if (iValue == enumMap.end())
19  throw cms::Exception("Configuration") << "the value " << value << " is not defined.";
20 
21  return iValue->second;
22  }
Definition: value.py:1
std::map< std::string, T > enumMap

Member Data Documentation

◆ enumMap

template<typename T>
std::map<std::string, T> StringToEnumParser< T >::enumMap
private

Definition at line 11 of file HcalTopologyMode.h.

Referenced by StringToEnumParser< T >::parseString().