10 #ifndef TEUCHOS_STRING_TO_INT_MAP_HPP
11 #define TEUCHOS_STRING_TO_INT_MAP_HPP
13 #include "Teuchos_Assert.hpp"
70 {
public:
AlreadyExists(
const std::string& what_arg) : std::logic_error(what_arg) {}};
74 {
public:
DoesNotExist(
const std::string& what_arg) : std::logic_error(what_arg) {}};
80 int get(
const std::string& option,
const std::string& groupName =
"" )
const;
83 template<
class EnumType>
84 EnumType
get(
const std::string& option,
const std::string& groupName =
"" )
const;
91 typedef std::map< std::string, int > map_t;
92 std::string defaultGroupName_;
95 std::string validSelections()
const;
105 template<
class EnumType>
109 ,std::string
const& option
110 ,std::string
const& groupName =
""
113 return static_cast<EnumType
>(theMap.get(option,groupName));
119 template<
class EnumType>
121 EnumType
StringToIntMap::get(
const std::string& option,
const std::string& groupName )
const
123 return static_cast<EnumType
>(
get(option,groupName));
129 return defaultGroupName_;
134 #endif // TEUCHOS_STRING_TO_INT_MAP_HPP
int get(const std::string &option, const std::string &groupName="") const
Map a std::string to an enumeration.
const std::string & defaultGroupName() const