10#ifndef TEUCHOS_STRING_TO_INT_MAP_HPP
11#define TEUCHOS_STRING_TO_INT_MAP_HPP
13#include "Teuchos_Assert.hpp"
69 class AlreadyExists :
public std::logic_error
70 {
public: AlreadyExists(
const std::string& what_arg) : std::logic_error(what_arg) {}};
73 class DoesNotExist :
public std::logic_error
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;
105template<
class EnumType>
109 ,std::string
const& option
110 ,std::string
const& groupName =
""
113 return static_cast<EnumType
>(theMap.
get(option,groupName));
119template<
class EnumType>
123 return static_cast<EnumType
>(
get(option,groupName));
129 return defaultGroupName_;
StringToIntMap(const std::string &defaultGroupName, int n, const char *strings[])
EnumType get(StringToIntMap const &theMap, std::string const &option, std::string const &groupName="")
Nonmember get function.
int get(const std::string &option, const std::string &groupName="") const
const std::string & defaultGroupName() const
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...