Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_ParameterListModifier.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_ParameterListModifier_hpp_
11 #define TEUCHOS_ParameterListModifier_hpp_
12 
17 #include "Teuchos_Describable.hpp"
19 #include "Teuchos_map.hpp"
20 #include "Teuchos_RCP.hpp"
21 namespace Teuchos {
22 
23 
24 #ifndef DOXYGEN_SHOULD_SKIP_THIS
25 class ParameterList;
26 #endif
27 
37 
38 public:
39 
41 
42 
44  ParameterListModifier() = default;
45 
47  ParameterListModifier(const std::string &name);
48 
50  virtual ~ParameterListModifier();
51 
53 
55  ParameterListModifier& setName( const std::string &name );
57 
59 
61  inline const std::string& getName() const{
63  return name_;
64  }
65 
67 
79  void printDoc(
80  std::string const& docString,
81  std::ostream &out
82  ) const;
83 
84 
97  Array<std::string> findMatchingBaseNames(const ParameterList &paramList,
98  const std::string &baseName, const bool &findParameters = true,
99  const bool &findSublists = true) const;
100 
112  virtual void modify(ParameterList &paramList, ParameterList &validParamList) const {};
113 
114 
126  virtual void reconcile(ParameterList &paramList) const {};
127 
128 
141  int expandParameters(const std::string &paramTemplateName, ParameterList &paramList,
142  ParameterList &validParamList,
143  const Array<std::string> &excludeParameters=Array<std::string>()) const;
144 
145 
158  int expandSublists(const std::string &sublistTemplateName, ParameterList &paramList,
159  ParameterList &validParamList,
160  const Array<std::string> &excludeSublists=Array<std::string>()) const;
161 
162 
174  int setDefaultsInSublists(const std::string &paramName, ParameterList &paramList,
175  const Array<std::string> &sublistNames, const bool removeParam = true) const;
176 
177 
191  int expandSublistsUsingBaseName(const std::string &baseName, ParameterList &paramList,
192  ParameterList &validParamList, const bool &allowBaseName = true) const;
193 
194 
195 protected:
196  std::string name_ = "ANONYMOUS";
197 
198 };
199 
203 inline bool operator==(const ParameterListModifier& plm1, const ParameterListModifier& plm2)
204 {
205  return (
206  plm1.getName() == plm2.getName()
207  && typeid(plm1) == typeid(plm2)
208  );
209 }
210 
214 inline bool operator!=(const ParameterListModifier& plm1, const ParameterListModifier& plm2)
215 {
216  return !( plm1 == plm2 );
217 }
218 
219 // /////////////////////////////////////////////////////
220 // Inline and Template Function Definitions
221 
222 
223 inline
225 {
226  name_ = name_in;
227  return *this;
228 }
229 
230 
231 } // end of Teuchos namespace
232 
233 #endif
bool operator==(const ParameterListModifier &plm1, const ParameterListModifier &plm2)
Returns true if two ParameterListModifier objects are equal.
const std::string & getName() const
Get the name of *this modifier.
Abstract interface for an object that can modify both a parameter list and the parameter list being u...
ParameterListModifier & setName(const std::string &name)
Set the name of *this modifier.
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::exce...
A list of parameters of arbitrary type.
#define TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
Provides std::map class for deficient platforms.
virtual void reconcile(ParameterList &paramList) const
Reconcile a parameter list and/or the valid parameter list being used to validate it and throw std::e...
Base class for all objects that can describe themselves.
Reference-counted pointer class and non-member templated function implementations.
bool operator!=(const ParameterListModifier &plm1, const ParameterListModifier &plm2)
Returns true if two ParameterListModifier objects are not equal.