Teuchos - Trilinos Tools Package
Version of the Day
|
Abstract interface for an object that can modify both a parameter list and the parameter list being used during the validation stage. More...
#include <Teuchos_ParameterListModifier.hpp>
Public Member Functions | |
void | printDoc (std::string const &docString, std::ostream &out) const |
Print documentation for this parameter list modifier. More... | |
Array< std::string > | findMatchingBaseNames (const ParameterList ¶mList, const std::string &baseName, const bool &findParameters=true, const bool &findSublists=true) const |
Find the parameters and/or sublists with matching base names. More... | |
virtual void | modify (ParameterList ¶mList, ParameterList &validParamList) const |
Modify a parameter list and/or the valid parameter list being used to validate it and throw std::exception (with a great error message) if modification fails. More... | |
virtual void | reconcile (ParameterList ¶mList) const |
Reconcile a parameter list and/or the valid parameter list being used to validate it and throw std::exception (with a great error message) if reconciliation fails. More... | |
int | expandParameters (const std::string ¶mTemplateName, ParameterList ¶mList, ParameterList &validParamList, const Array< std::string > &excludeParameters=Array< std::string >()) const |
Create parameters in the valid parameter list using a template parameter from the valid parameter list and the names of parameters in the list being validated. More... | |
int | expandSublists (const std::string &sublistTemplateName, ParameterList ¶mList, ParameterList &validParamList, const Array< std::string > &excludeSublists=Array< std::string >()) const |
Create sublists in the valid parameter list using a template parameter from the valid parameter list and the names of sublists in the list being validated. More... | |
int | setDefaultsInSublists (const std::string ¶mName, ParameterList ¶mList, const Array< std::string > &sublistNames, const bool removeParam=true) const |
Copy a parameter into desired sublists. More... | |
int | expandSublistsUsingBaseName (const std::string &baseName, ParameterList ¶mList, ParameterList &validParamList, const bool &allowBaseName=true) const |
Create sublists in the valid parameter list using a base name and the corresponding sublists in the parameter list being validated. More... | |
Constructors/Destructor | |
ParameterListModifier ()=default | |
Constructor. More... | |
ParameterListModifier (const std::string &name) | |
Constructor that names the modifier. More... | |
virtual | ~ParameterListModifier () |
Destructor. More... | |
Set Functions | |
ParameterListModifier & | setName (const std::string &name) |
Set the name of *this modifier. More... | |
Public Member Functions inherited from Teuchos::Describable | |
virtual std::string | description () const |
Return a simple one-line description of this object. More... | |
virtual void | describe (FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const |
Print the object with some verbosity level to a FancyOStream. More... | |
void | describe (std::ostream &out, const EVerbosityLevel verbLevel=verbLevel_default) const |
Version of describe() that takes an std::ostream instead of a FancyOStream. More... | |
virtual | ~Describable () |
Destructor (marked virtual for memory safety of derived classes). More... | |
Public Member Functions inherited from Teuchos::LabeledObject | |
LabeledObject () | |
Construct with an empty label. More... | |
virtual | ~LabeledObject () |
virtual void | setObjectLabel (const std::string &objectLabel) |
Set the object label (see LabeledObject). More... | |
virtual std::string | getObjectLabel () const |
Get the object label (see LabeledObject). More... | |
Additional Inherited Members | |
Static Public Attributes inherited from Teuchos::Describable | |
static const EVerbosityLevel | verbLevel_default = VERB_DEFAULT |
Default value for the verbLevel argument of describe(). More... | |
Related Functions inherited from Teuchos::Describable | |
DescribableStreamManipulatorState | describe (const Describable &describable, const EVerbosityLevel verbLevel=Describable::verbLevel_default) |
Describable output stream manipulator. More... | |
std::ostream & | operator<< (std::ostream &os, const DescribableStreamManipulatorState &d) |
Output stream operator for Describable manipulator. More... | |
Abstract interface for an object that can modify both a parameter list and the parameter list being used during the validation stage.
A parameter (sub)list modifier can be used to process optional fields and dependent fields before validation. It can also be used after validation to reconcile parameters that may have dependencies on other parameters.
Definition at line 68 of file Teuchos_ParameterListModifier.hpp.
|
default |
Constructor.
Teuchos::ParameterListModifier::ParameterListModifier | ( | const std::string & | name | ) |
Constructor that names the modifier.
Definition at line 51 of file Teuchos_ParameterListModifier.cpp.
|
virtual |
Destructor.
Definition at line 55 of file Teuchos_ParameterListModifier.cpp.
|
inline |
Set the name of *this
modifier.
Definition at line 230 of file Teuchos_ParameterListModifier.hpp.
void Teuchos::ParameterListModifier::printDoc | ( | std::string const & | docString, |
std::ostream & | out | ||
) | const |
Print documentation for this parameter list modifier.
docString | [in] (Multi-line) documentation std::string. |
out | [out] The std::ostream used for the output |
The purpose of this function is to augment what is in docString
with some description of what happens during the modification and reconciliation stages of this modifier.
Definition at line 59 of file Teuchos_ParameterListModifier.cpp.
Array< std::string > Teuchos::ParameterListModifier::findMatchingBaseNames | ( | const ParameterList & | paramList, |
const std::string & | baseName, | ||
const bool & | findParameters = true , |
||
const bool & | findSublists = true |
||
) | const |
Find the parameters and/or sublists with matching base names.
paramList | [in] Modified parameter list to search. |
findParameters | [out] Search through parameters |
findSublists | [out] Search through sublists (not recursive) |
This convenience function makes it easy to search through the current level of a given parameter list and find all parameters and/or sublists that begin with a given name.
Definition at line 66 of file Teuchos_ParameterListModifier.cpp.
|
inlinevirtual |
Modify a parameter list and/or the valid parameter list being used to validate it and throw std::exception (with a great error message) if modification fails.
paramList | [in] The parameter list that needs to be validated |
validParamList | [in] The parameter list being used as a template for validation. |
This function is usually called before the validation step begins in order to create optional parameters and/or sublists.
Definition at line 136 of file Teuchos_ParameterListModifier.hpp.
|
inlinevirtual |
Reconcile a parameter list and/or the valid parameter list being used to validate it and throw std::exception (with a great error message) if reconciliation fails.
paramList | [in,out] The parameter list that needs to be validated |
validParamList | [in,out] The parameter list being used as a template for validation. |
This function is usually called after the validation step begins in order to check that dependencies between multiple parameters are satisfied.
Definition at line 150 of file Teuchos_ParameterListModifier.hpp.
int Teuchos::ParameterListModifier::expandParameters | ( | const std::string & | paramTemplateName, |
ParameterList & | paramList, | ||
ParameterList & | validParamList, | ||
const Array< std::string > & | excludeParameters = Array<std::string>() |
||
) | const |
Create parameters in the valid parameter list using a template parameter from the valid parameter list and the names of parameters in the list being validated.
parameterTemplateName | [in] The name of the parameter template in valid_pl |
paramList | [in] The parameter list that needs to be validated |
validParamList | [in,out] The parameter list that is being used as a template for validation |
excludeParameters | [in] An optional list of parameter names to exclude |
Definition at line 90 of file Teuchos_ParameterListModifier.cpp.
int Teuchos::ParameterListModifier::expandSublists | ( | const std::string & | sublistTemplateName, |
ParameterList & | paramList, | ||
ParameterList & | validParamList, | ||
const Array< std::string > & | excludeSublists = Array<std::string>() |
||
) | const |
Create sublists in the valid parameter list using a template parameter from the valid parameter list and the names of sublists in the list being validated.
sublistTemplateName | [in] The name of the sublist template in valid_pl |
paramList | [in] The parameter list that needs to be validated |
validParamList | [in,out] The parameter list that is being used as a template for validation |
excludeSublists | [in] An optional list of sublist names to exclude |
Definition at line 115 of file Teuchos_ParameterListModifier.cpp.
int Teuchos::ParameterListModifier::setDefaultsInSublists | ( | const std::string & | paramName, |
ParameterList & | paramList, | ||
const Array< std::string > & | sublistNames, | ||
const bool | removeParam = true |
||
) | const |
Copy a parameter into desired sublists.
paramName | [in] The name of the parameter to be copied. |
paramList | [in,out] The parameter list with paramName. |
sublistNames | [in] The names of any sublists in paramList to set the defaults in using parameter paramName. |
removeParam | [in] Remove paramName from paramList after defaults are set in sublists. |
Definition at line 166 of file Teuchos_ParameterListModifier.cpp.
int Teuchos::ParameterListModifier::expandSublistsUsingBaseName | ( | const std::string & | baseName, |
ParameterList & | paramList, | ||
ParameterList & | validParamList, | ||
const bool & | allowBaseName = true |
||
) | const |
Create sublists in the valid parameter list using a base name and the corresponding sublists in the parameter list being validated.
baseName | [in] The root name of the sublists to look for and create |
paramList | [in] The parameter list that needs to be validated |
validParamList | [in,out] The parameter list that is being used as a template for validation |
allowBaseName | [in] Allow the parameter list pl to contain a parameter with the same name as base_name. |
Definition at line 140 of file Teuchos_ParameterListModifier.cpp.