test
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 Attributes
StringToEnumParser< T > Class Template Reference

#include <HcalTopologyMode.h>

Public Member Functions

T parseString (const std::string &value)
 
T parseString (const std::string &value)
 
template<>
 StringToEnumParser ()
 
template<>
 StringToEnumParser ()
 
template<>
 StringToEnumParser ()
 
 StringToEnumParser (void)
 
 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

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

Definition at line 4 of file HcalTopologyMode.cc.

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

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

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

Member Function Documentation

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" )
20  << "the value " << value << " is not defined.";
21 
22  return iValue->second;
23  }
std::map< std::string, T > enumMap
template<typename T>
T StringToEnumParser< T >::parseString ( const std::string &  value)
inline

Definition at line 17 of file HcalTopologyMode.h.

References StringToEnumParser< T >::enumMap.

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

Member Data Documentation

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

Definition at line 12 of file HcalTopologyMode.h.

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