43validate(
const Teuchos::ParameterEntry & entry,
44 const std::string & paramName,
45 const std::string & sublistName)
const
47 const std::string &entryName = entry.getAny(
false).typeName();
48 Teuchos::any anyValue = entry.getAny(
true);
51 TEUCHOS_TEST_FOR_EXCEPTION(!(anyValue.type() ==
typeid(std::string) ),
52 Teuchos::Exceptions::InvalidParameterType,
53 "Sorry but it looks like the \"" << paramName <<
"\"" <<
54 " parameter in the \"" << sublistName <<
55 "\" sublist does not exist." << std::endl << std::endl <<
56 "Error: The value that you entered was the wrong type." << std::endl <<
57 "Parameter: " << paramName << std::endl <<
58 "Type specified: " << entryName << std::endl <<
59 "Type accepted: " <<
typeid(std::string).name() <<
60 std::endl << std::endl);
62 const std::string & value = Teuchos::any_cast<std::string>(anyValue);
64 std::vector<std::string> tokens;
65 split(value,
",",tokens);
68 const std::string errorStr =
"The value for \"string-list\" type parameter in sublist \""+sublistName+
"\" named \""+paramName+
"\" "
69 "is incorrectly formatted. The expected format is\n"
70 " \"<string>[, <string>]*\" "
71 "your value is \""+value+
"\"";
74 TEUCHOS_TEST_FOR_EXCEPTION(tokens.size()==0,
75 Teuchos::Exceptions::InvalidParameterValue,errorStr);
static void split(const std::string &str, const std::string &delim, std::vector< std::string > &tokens)
Utility function for tokenizing.
void validate(const Teuchos::ParameterEntry &entry, const std::string ¶mName, const std::string &sublistName) const
void printDoc(const std::string &docString, std::ostream &out) const
void StringTokenizer(std::vector< std::string > &tokens, const std::string &str, const std::string delimiters, bool trim)
Tokenize a string, put tokens in a vector.