Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | Related Functions | List of all members
Teuchos::ParameterListModifier Class Reference

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>

Inheritance diagram for Teuchos::ParameterListModifier:
Inheritance graph
[legend]

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 &paramList, 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 &paramList, 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 &paramList) 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 &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. More...
 
int 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. More...
 
int setDefaultsInSublists (const std::string &paramName, ParameterList &paramList, const Array< std::string > &sublistNames, const bool removeParam=true) const
 Copy a parameter into desired sublists. More...
 
int 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. 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...
 

Protected Attributes

std::string name_ = "ANONYMOUS"
 

Related Functions

(Note that these are not member functions.)

bool operator== (const ParameterListModifier &plm1, const ParameterListModifier &plm2)
 Returns true if two ParameterListModifier objects are equal. More...
 
bool operator!= (const ParameterListModifier &plm1, const ParameterListModifier &plm2)
 Returns true if two ParameterListModifier objects are not equal. More...
 

Constructors/Destructor

 ParameterListModifier ()=default
 Constructor. More...
 
 ParameterListModifier (const std::string &name)
 Constructor that names the modifier. More...
 
virtual ~ParameterListModifier ()
 Destructor. More...
 

Set Functions

ParameterListModifiersetName (const std::string &name)
 Set the name of *this modifier. More...
 

Get Functions

const std::string & getName () const
 Get the name of *this modifier. 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

Teuchos::ParameterListModifier::ParameterListModifier ( )
default

Constructor.

Teuchos::ParameterListModifier::ParameterListModifier ( const std::string &  name)

Constructor that names the modifier.

Definition at line 51 of file Teuchos_ParameterListModifier.cpp.

Teuchos::ParameterListModifier::~ParameterListModifier ( )
virtual

Destructor.

Definition at line 55 of file Teuchos_ParameterListModifier.cpp.

Member Function Documentation

ParameterListModifier & Teuchos::ParameterListModifier::setName ( const std::string &  name)
inline

Set the name of *this modifier.

Definition at line 256 of file Teuchos_ParameterListModifier.hpp.

const std::string& Teuchos::ParameterListModifier::getName ( ) const
inline

Get the name of *this modifier.

Definition at line 94 of file Teuchos_ParameterListModifier.hpp.

void Teuchos::ParameterListModifier::printDoc ( std::string const &  docString,
std::ostream &  out 
) const

Print documentation for this parameter list modifier.

Parameters
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.

Parameters
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.

virtual void Teuchos::ParameterListModifier::modify ( ParameterList paramList,
ParameterList validParamList 
) const
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.

Parameters
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 144 of file Teuchos_ParameterListModifier.hpp.

virtual void Teuchos::ParameterListModifier::reconcile ( ParameterList paramList) const
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.

Parameters
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 158 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.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
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.

Friends And Related Function Documentation

bool operator== ( const ParameterListModifier plm1,
const ParameterListModifier plm2 
)
related

Returns true if two ParameterListModifier objects are equal.

Definition at line 235 of file Teuchos_ParameterListModifier.hpp.

bool operator!= ( const ParameterListModifier plm1,
const ParameterListModifier plm2 
)
related

Returns true if two ParameterListModifier objects are not equal.

Definition at line 246 of file Teuchos_ParameterListModifier.hpp.

Member Data Documentation

std::string Teuchos::ParameterListModifier::name_ = "ANONYMOUS"
protected

Definition at line 228 of file Teuchos_ParameterListModifier.hpp.


The documentation for this class was generated from the following files: