CMS 3D CMS Logo

Public Member Functions | Private Attributes

StringToEnumParser< T > Class Template Reference

#include <HcalTopologyMode.h>

List of all members.

Public Member Functions

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

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.

{
    enumMap["HcalTopologyMode::LHC"] = HcalTopologyMode::LHC;
    enumMap["HcalTopologyMode::H2"] = HcalTopologyMode::H2;
    enumMap["HcalTopologyMode::SLHC"] = HcalTopologyMode::SLHC;
    enumMap["HcalTopologyMode::H2HE"] = HcalTopologyMode::H2HE;
}

Member Function Documentation

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

Definition at line 17 of file HcalTopologyMode.h.

References StringToEnumParser< T >::enumMap.

Referenced by HcalTopologyIdealEP::produce().

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

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().