42 #ifndef TEUCHOS_STRING_TO_INT_MAP_HPP
43 #define TEUCHOS_STRING_TO_INT_MAP_HPP
45 #include "Teuchos_Assert.hpp"
100 {
public:
AlreadyExists(
const std::string& what_arg) : std::logic_error(what_arg) {}};
104 {
public:
DoesNotExist(
const std::string& what_arg) : std::logic_error(what_arg) {}};
110 int get(
const std::string& option,
const std::string& groupName =
"" )
const;
113 template<
class EnumType>
114 EnumType
get(
const std::string& option,
const std::string& groupName =
"" )
const;
121 typedef std::map< std::string, int > map_t;
122 std::string defaultGroupName_;
125 std::string validSelections()
const;
135 template<
class EnumType>
139 ,std::string
const& option
140 ,std::string
const& groupName =
""
143 return static_cast<EnumType
>(theMap.get(option,groupName));
149 template<
class EnumType>
151 EnumType
StringToIntMap::get(
const std::string& option,
const std::string& groupName )
const
153 return static_cast<EnumType
>(
get(option,groupName));
159 return defaultGroupName_;
164 #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