43 #ifndef TEUCHOS_PARAMETER_ENTRY_VALIDATOR_H
44 #define TEUCHOS_PARAMETER_ENTRY_VALIDATOR_H
49 #include "Teuchos_Describable.hpp"
54 #ifndef DOXYGEN_SHOULD_SKIP_THIS
88 virtual const std::string getXMLTypeName()
const=0;
101 virtual void printDoc(
102 std::string
const& docString,
114 virtual ValidStringsList validStringValues()
const = 0;
127 virtual void validate(
129 std::string
const& paramName,
130 std::string
const& sublistName
147 std::string
const& paramName,
148 std::string
const& sublistName,
153 this->validate(*entry,paramName,sublistName);
156 double convertStringToDouble(std::string str)
const
158 #ifdef HAVE_TEUCHOSCORE_CXX11
160 double result = std::stod(str, &idx);
161 if(idx != str.length()) {
162 throw std::invalid_argument(
"String: '" + str +
"' had bad formatting for converting to a double." );
166 return std::atof(str.c_str());
170 int convertStringToInt(std::string str)
const
172 #ifdef HAVE_TEUCHOSCORE_CXX11
174 int result = std::stoi(str, &idx);
175 if(idx != str.length()) {
176 throw std::invalid_argument(
"String: '" + str +
"' had bad formatting for converting to an int." );
180 return std::atoi(str.c_str());
184 int convertStringToLongLong(std::string str)
const
187 long long result = std::stoll(str, &idx);
188 if(idx != str.length()) {
189 throw std::invalid_argument(
"String: '" + str +
"' had bad formatting for converting to a long long." );
200 #endif // TEUCHOS_PARAMETER_ENTRY_VALIDATOR_H
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.
Abstract interface for an object that can validate a ParameterEntry's value.
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.