10 #ifndef TEUCHOS_PARAMETER_ENTRY_VALIDATOR_H
11 #define TEUCHOS_PARAMETER_ENTRY_VALIDATOR_H
21 #ifndef DOXYGEN_SHOULD_SKIP_THIS
55 virtual const std::string getXMLTypeName()
const=0;
68 virtual void printDoc(
69 std::string
const& docString,
81 virtual ValidStringsList validStringValues()
const = 0;
94 virtual void validate(
96 std::string
const& paramName,
97 std::string
const& sublistName
114 std::string
const& paramName,
115 std::string
const& sublistName,
120 this->validate(*entry,paramName,sublistName);
125 #ifdef HAVE_TEUCHOSCORE_CXX11
127 double result = std::stod(str, &idx);
128 if(idx != str.length()) {
129 throw std::invalid_argument(
"String: '" + str +
"' had bad formatting for converting to a double." );
133 return std::atof(str.c_str());
139 #ifdef HAVE_TEUCHOSCORE_CXX11
141 int result = std::stoi(str, &idx);
142 if(idx != str.length()) {
143 throw std::invalid_argument(
"String: '" + str +
"' had bad formatting for converting to an int." );
147 return std::atoi(str.c_str());
154 long long result = std::stoll(str, &idx);
155 if(idx != str.length()) {
156 throw std::invalid_argument(
"String: '" + str +
"' had bad formatting for converting to a long long." );
167 #endif // TEUCHOS_PARAMETER_ENTRY_VALIDATOR_H
int convertStringToInt(std::string str) const
This object is held as the "value" in the Teuchos::ParameterList std::map.
virtual void validateAndModify(std::string const ¶mName, std::string const &sublistName, ParameterEntry *entry) const
Validate and perhaps modify a parameter entry's value.
double convertStringToDouble(std::string str) const
#define TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
Abstract interface for an object that can validate a ParameterEntry's value.
int convertStringToLongLong(std::string str) const
Templated array class derived from the STL std::vector.
RCP< const Array< std::string > > ValidStringsList
ParameterEntryValidator()
Default Constructor.
Base class for all objects that can describe themselves.
Smart reference counting pointer class for automatic garbage collection.
Reference-counted pointer class and non-member templated function implementations.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
This macro is designed to be a short version of TEUCHOS_TEST_FOR_EXCEPTION() that is easier to call...
An object representation of a subset of XML data.