42 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
43 #include "Teuchos_StandardParameterEntryValidators.hpp"
49 const std::string VerboseObject_name =
"VerboseObject";
51 const std::string OutputFile_name =
"Output File";
52 const std::string OutputFile_default =
"none";
54 const std::string VerbosityLevel_name =
"Verbosity Level";
55 const std::string VerbosityLevel_default =
"default";
59 VerbosityLevel_validator;
67 Teuchos::getValidVerboseObjectSublist()
69 using Teuchos::rcp_implicit_cast;
70 static RCP<const ParameterList> validParams;
73 pl =
rcp(
new ParameterList(VerboseObject_name));
74 VerbosityLevel_validator = verbosityLevelParameterEntryValidator(VerbosityLevel_name);
76 VerbosityLevel_name, VerbosityLevel_default,
77 "The verbosity level to use to override whatever is set in code.\n"
78 "The value of \"default\" will allow the level set in code to be used.",
79 rcp_implicit_cast<const ParameterEntryValidator>(VerbosityLevel_validator)
82 OutputFile_name, OutputFile_default,
83 "The file to send output to. If the value \"none\" is used, then\n"
84 "whatever is set in code will be used. However, any other std::string value\n"
85 "will be used to create an std::ofstream object to a file with the given name.\n"
86 "Therefore, any valid file name is a valid std::string value for this parameter."
94 void Teuchos::setupVerboseObjectSublist( ParameterList* paramList )
97 paramList->sublist(VerboseObject_name).setParameters(
99 ).disableRecursiveValidation();
103 void Teuchos::readVerboseObjectSublist(
104 ParameterList* paramList,
113 &voSublist = paramList->sublist(VerboseObject_name);
116 outputFileStr = voSublist.get(OutputFile_name,OutputFile_default);
117 *verbLevel = VerbosityLevel_validator->getIntegralValue(
118 voSublist,VerbosityLevel_name,VerbosityLevel_default
120 if (outputFileStr==OutputFile_default) {
125 oFileStream =
rcp(
new std::ofstream(outputFileStr.c_str()));
127 oFileStream->eof(), Exceptions::InvalidParameterValue,
128 "Error, the file \"" << outputFileStr <<
"\n given by the parameter\n"
129 "\'" << OutputFile_name <<
"\' in the sublist\n"
130 "\'" << voSublist.name() <<
"\' count not be opened for output!"
132 *oStream =
fancyOStream(rcp_implicit_cast<std::ostream>(oFileStream));