43#ifndef TEUCHOS_PARAMETER_ENTRY_VALIDATOR_H
44#define TEUCHOS_PARAMETER_ENTRY_VALIDATOR_H
54#ifndef DOXYGEN_SHOULD_SKIP_THIS
102 std::string
const& docString,
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);
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());
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());
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." );
Templated array class derived from the STL std::vector.
#define TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
Reference-counted pointer class and non-member templated function implementations.
An object representation of a subset of XML data.
Base class for all objects that can describe themselves.
Abstract interface for an object that can validate a ParameterEntry's value.
virtual void printDoc(std::string const &docString, std::ostream &out) const =0
Print documentation for this parameter.
virtual ValidStringsList validStringValues() const =0
Return an array of strings of valid values if applicable.
virtual void validate(ParameterEntry const &entry, std::string const ¶mName, std::string const &sublistName) const =0
Validate a parameter entry value and throw std::exception (with a great error message) if validation ...
int convertStringToInt(std::string str) const
virtual void validateAndModify(std::string const ¶mName, std::string const &sublistName, ParameterEntry *entry) const
Validate and perhaps modify a parameter entry's value.
virtual const std::string getXMLTypeName() const =0
Get a string that should be used as a value of the type attribute when serializing it to XML.
RCP< const Array< std::string > > ValidStringsList
double convertStringToDouble(std::string str) const
int convertStringToLongLong(std::string str) const
ParameterEntryValidator()
Default Constructor.
This object is held as the "value" in the Teuchos::ParameterList std::map.
Smart reference counting pointer class for automatic garbage collection.
#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.