Teuchos - Trilinos Tools Package  Version of the Day
Teuchos_ParameterList.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Teuchos: Common Tools Package
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 
43 #ifndef TEUCHOS_PARAMETER_LIST_H
44 #define TEUCHOS_PARAMETER_LIST_H
45 
50 #include "Teuchos_ParameterListExceptions.hpp"
52 #include "Teuchos_StringIndexedOrderedValueObjectContainer.hpp"
53 #include "Teuchos_Assert.hpp"
54 #include "Teuchos_RCP.hpp"
55 #include "Teuchos_Array.hpp"
56 #include "Teuchos_map.hpp"
57 
58 
63 namespace Teuchos {
64 
75 };
76 
87 };
88 
132 class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT ParameterList {
133 
136 
139 
140 public:
141 
143 
144 
147 
149  class PrintOptions {
150  public:
151  PrintOptions() : indent_(0), showTypes_(false), showFlags_(false), showDoc_(false) {}
152  PrintOptions& indent(int _indent) { indent_ = _indent; return *this; }
153  PrintOptions& showTypes(bool _showTypes) { showTypes_ = _showTypes; return *this; }
154  PrintOptions& showFlags(bool _showFlags) { showFlags_ = _showFlags; return *this; }
155  PrintOptions& showDoc(bool _showDoc) { showDoc_ = _showDoc; return *this; }
156  PrintOptions& incrIndent(int indents) { indent_ += indents; return *this; }
157  int indent() const { return indent_; }
158  bool showTypes() const { return showTypes_; }
159  bool showFlags() const { return showFlags_; }
160  bool showDoc() const { return showDoc_; }
161  PrintOptions copy() const { return PrintOptions(*this); }
162  private:
163  int indent_;
164  bool showTypes_;
165  bool showFlags_;
166  bool showDoc_;
167  };
168 
170 
172 
173 
175  ParameterList();
176 
178  ParameterList(const std::string &name);
179 
181  ParameterList(const ParameterList& source);
182 
184  virtual ~ParameterList();
185 
187  Ordinal numParams () const;
188 
190 
192 
194  ParameterList& setName( const std::string &name );
195 
199  ParameterList& operator= (const ParameterList& source);
200 
209  ParameterList& setParameters(const ParameterList& source);
210 
220  ParameterList& setParametersNotAlreadySet(const ParameterList& source);
221 
229  ParameterList& disableRecursiveValidation();
230 
249  template<typename T>
250  ParameterList& set (std::string const& name,
251  T const& value,
252  std::string const& docString = "",
253  RCP<const ParameterEntryValidator> const& validator = null);
254 
259  ParameterList& set(
260  std::string const& name, char value[], std::string const& docString = "",
261  RCP<const ParameterEntryValidator> const& validator = null
262  );
263 
268  ParameterList& set(
269  std::string const& name, const char value[], std::string const& docString = "",
270  RCP<const ParameterEntryValidator> const& validator = null
271  );
272 
276  ParameterList& set(
277  std::string const& name, ParameterList const& value, std::string const& docString = ""
278  );
279 
284  ParameterList& setEntry(const std::string& name, const ParameterEntry& entry);
285 
287 
289 
306  template<typename T>
307  T& get(const std::string& name, T def_value);
308 
312  std::string& get(const std::string& name, char def_value[]);
313 
317  std::string& get(const std::string& name, const char def_value[]);
318 
349  template<typename T>
350  T& get (const std::string& name);
351 
379  template<typename T>
380  const T& get (const std::string& name) const;
381 
387  template<typename T>
388  inline
389  T* getPtr(const std::string& name);
390 
396  template<typename T>
397  inline
398  const T* getPtr(const std::string& name) const;
399 
400  // ToDo: Add getSafePtr() functions to return Ptr<T> instead of raw T*
401 
407  ParameterEntry& getEntry(const std::string& name);
408 
414  inline
415  const ParameterEntry& getEntry(const std::string& name) const;
416 
419  inline
420  ParameterEntry* getEntryPtr(const std::string& name);
421 
422  // ToDo: Add function called getEntrySafePtr() to return Ptr<> as the main
423  // implementation and deprecate getEntryPtr()
424 
427  inline
428  const ParameterEntry* getEntryPtr(const std::string& name) const;
429 
432  inline RCP<ParameterEntry> getEntryRCP(const std::string& name);
433 
436  inline RCP<const ParameterEntry> getEntryRCP(const std::string& name) const;
437 
439 
441 
442 
456  bool remove(
457  std::string const& name, bool throwIfNotExists = true
458  );
459 
461 
463 
464 
470  ParameterList& sublist(
471  const std::string& name, bool mustAlreadyExist = false
472  ,const std::string& docString = ""
473  );
474 
479  const ParameterList& sublist(const std::string& name) const;
480 
482 
484 
485 
487  const std::string& name() const;
488 
493  bool isParameter (const std::string& name) const;
494 
499  bool isSublist (const std::string& name) const;
500 
506  template<typename T>
507  bool isType (const std::string& name) const;
508 
509 #ifndef DOXYGEN_SHOULD_SKIP_THIS
510 
520  template<typename T>
521  bool isType(const std::string& name, T* ptr) const;
522 #endif
523 
525 
527 
528 
534  void print() const;
535 
538  std::ostream& print(std::ostream& os, const PrintOptions &printOptions) const;
539 
542  std::ostream& print(std::ostream& os, int indent = 0, bool showTypes = false, bool showFlags = true ) const;
543 
545  void unused(std::ostream& os) const;
546 
548  std::string currentParametersString() const;
549 
551 
553 
554 
556  inline ConstIterator begin() const;
557 
559  inline ConstIterator end() const;
560 
562  inline const std::string& name(ConstIterator i) const;
563 
565  inline const ParameterEntry& entry(ConstIterator i) const;
566 
568 
570 
571 
616  void validateParameters(
617  ParameterList const& validParamList,
618  int const depth = 1000,
619  EValidateUsed const validateUsed = VALIDATE_USED_ENABLED,
620  EValidateDefaults const validateDefaults = VALIDATE_DEFAULTS_ENABLED
621  ) const;
622 
660  void validateParametersAndSetDefaults(
661  ParameterList const& validParamList,
662  int const depth = 1000
663  );
664 
666 
667 private: // Functions
668 
670  inline Iterator nonconstBegin();
672  inline Iterator nonconstEnd();
674  inline ParameterEntry& nonconstEntry(Iterator i);
676  void validateEntryExists(const std::string &funcName, const std::string &name,
677  const ParameterEntry *entry) const;
678  // ToDo: Change above function to take Ptr<> instead of raw pointer.
680  template<typename T>
681  void validateEntryType(const std::string &funcName, const std::string &name,
682  const ParameterEntry &entry ) const;
684  void validateEntryIsList(const std::string &name, const ParameterEntry &entry) const;
686  void validateMissingSublistMustExist(const std::string &baselist_name,
687  const std::string &sublist_name, const bool mustAlreadyExist) const;
689  void updateSubListNames(int depth = 0);
690 
691 private: // Data members
692 
694  std::string name_;
695 
697 //use pragmas to disable some false-positive warnings for windows sharedlibs export
698 //#ifdef _MSC_VER
699 //#pragma warning(push)
700 //#pragma warning(disable:4251)
701 //#endif
702  params_t params_;
703 //#ifdef _MSC_VER
704 //#pragma warning(pop)
705 //#endif
706 
708  bool disableRecursiveValidation_;
709 
710 };
711 
712 
717 inline
719 {
720  return rcp(new ParameterList);
721 }
722 
723 
728 inline
729 RCP<ParameterList> parameterList(const std::string &name)
730 {
731  return rcp(new ParameterList(name));
732 }
733 
734 
739 inline
741 {
742  return rcp(new ParameterList(source));
743 }
744 
745 
750 inline
752 {
753  return rcp(new ParameterList);
754 }
755 
756 
761 inline
762 RCP<ParameterList> createParameterList(const std::string &name)
763 {
764  return rcp(new ParameterList(name));
765 }
766 
767 
772 template<>
773 class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT TypeNameTraits<ParameterList> {
774 public:
775  static std::string name() { return "ParameterList"; }
776  static std::string concreteName( const ParameterList& /*t2*/ )
777  { return name(); }
778 };
779 
780 
785 TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT bool operator==( const ParameterList& list1, const ParameterList& list2 );
786 
787 
792 inline
793 bool operator!=( const ParameterList& list1, const ParameterList& list2 )
794 {
795  return !( list1 == list2 );
796 }
797 
798 
810 TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT bool haveSameValues( const ParameterList& list1, const ParameterList& list2,
811  bool verbose = false);
812 
813 
814 // /////////////////////////////////////////////////////
815 // Inline and Template Function Definitions
816 
817 
818 inline
819 ParameterList& ParameterList::setName( const std::string &name_in )
820 {
821  name_ = name_in;
822  return *this;
823 }
824 
825 
826 // Set functions
827 
828 
829 template<typename T>
830 inline
832  std::string const& name_in, T const& value_in, std::string const& docString_in,
833  RCP<const ParameterEntryValidator> const& validator_in
834  )
835 {
837  const Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
838  if (param_idx != SIOVOCB::getInvalidOrdinal()) {
839  Ptr<ParameterEntry> param = params_.getNonconstObjPtr(param_idx);
840  const std::string docString =
841  (docString_in.length() ? docString_in : param->docString());
842  const RCP<const ParameterEntryValidator> validator =
843  (nonnull(validator_in) ? validator_in : param->validator());
844  // Create temp param to validate before setting
845  ParameterEntry param_new(value_in, false, false, docString, validator );
846  if (nonnull(validator)) {
847  validator->validate(param_new, name_in, this->name());
848  }
849  // Strong guarantee: (if exception is thrown, the value is not changed)
850  *param = param_new;
851  }
852  else {
853  ParameterEntry param_new(value_in, false, false, docString_in, validator_in);
854  if (nonnull(param_new.validator())) {
855  param_new.validator()->validate(param_new, name_in, this->name());
856  }
857  params_.setObj(name_in, param_new);
858  }
859  return *this;
860 }
861 
862 
863 inline
865  std::string const& name_in, char value[], std::string const& docString
866  ,RCP<const ParameterEntryValidator> const& validator
867  )
868 { return set(name_in, std::string(value), docString, validator); }
869 
870 
871 inline
873  const std::string& name_in, const char value[], const std::string &docString
874  ,RCP<const ParameterEntryValidator> const& validator
875  )
876 { return set( name_in, std::string(value), docString, validator ); }
877 
878 
879 inline
881  std::string const& name_in, ParameterList const& value, std::string const& /*docString*/
882  )
883 {
884  sublist(name_in) = value;
885  return *this;
886 }
887 
888 
889 inline
890 ParameterList& ParameterList::setEntry(std::string const& name_in, ParameterEntry const& entry_in)
891 {
892  params_.setObj(name_in, entry_in);
893  return *this;
894 }
895 
896 
897 // Get functions
898 
899 
900 template<typename T>
901 T& ParameterList::get(const std::string& name_in, T def_value)
902 {
904  Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
905  if (param_idx == SIOVOCB::getInvalidOrdinal()) {
906  // Param does not exist
907  param_idx = params_.setObj(name_in, ParameterEntry(def_value, true));
908  }
909  Ptr<ParameterEntry> param = params_.getNonconstObjPtr(param_idx);
910  this->template validateEntryType<T>("get", name_in, *param);
911  return getValue<T>(*param);
912 }
913 
914 
915 inline
916 std::string& ParameterList::get(const std::string& name_in, char def_value[])
917 { return get(name_in, std::string(def_value)); }
918 
919 
920 inline
921 std::string& ParameterList::get(const std::string& name_in, const char def_value[])
922 { return get(name_in, std::string(def_value)); }
923 
924 
925 template<typename T>
926 T& ParameterList::get(const std::string& name_in)
927 {
928  ParameterEntry *foundEntry = this->getEntryPtr(name_in);
929  validateEntryExists("get",name_in,foundEntry);
930  this->template validateEntryType<T>("get",name_in,*foundEntry);
931  return getValue<T>(*foundEntry);
932 }
933 
934 
935 template<typename T>
936 const T& ParameterList::get(const std::string& name_in) const
937 {
938  const ParameterEntry *foundEntry = this->getEntryPtr(name_in);
939  validateEntryExists("get",name_in,foundEntry);
940  this->template validateEntryType<T>("get",name_in,*foundEntry);
941  return getValue<T>(*foundEntry);
942 }
943 
944 
945 template<typename T>
946 inline
947 T* ParameterList::getPtr(const std::string& name_in)
948 {
950  const Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
951  if (param_idx != SIOVOCB::getInvalidOrdinal()) {
952  const Ptr<ParameterEntry> param_ptr = params_.getNonconstObjPtr(param_idx);
953  if (param_ptr->isType<T>()) {
954  return &param_ptr->getValue<T>(0);
955  }
956  // Note: The above is inefficinet. You have to do the dynamic_cast twice
957  // (once to see if it is the type and once to do the cast). This could be
958  // made more efficinet by upgrading Teuchos::any to add a any_cast_ptr()
959  // function but I don't think anyone actually uses this function.
960  return 0;
961  }
962  return 0;
963 }
964 
965 
966 template<typename T>
967 inline
968 const T* ParameterList::getPtr(const std::string& name_in) const
969 {
971  const Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
972  if (param_idx != SIOVOCB::getInvalidOrdinal()) {
973  const Ptr<const ParameterEntry> param_ptr = params_.getObjPtr(param_idx);
974  if (param_ptr->isType<T>()) {
975  return &param_ptr->getValue<T>(0);
976  }
977  // Note: The above is inefficinet, see above non-const getPtr() function.
978  return 0;
979  }
980  return 0;
981 }
982 
983 
984 inline
985 ParameterEntry& ParameterList::getEntry(const std::string& name_in)
986 {
987  ParameterEntry *foundEntry = this->getEntryPtr(name_in);
988  validateEntryExists("get", name_in, foundEntry);
989  return *foundEntry;
990 }
991 
992 
993 inline
994 const ParameterEntry& ParameterList::getEntry(const std::string& name_in) const
995 {
996  const ParameterEntry *foundEntry = this->getEntryPtr(name_in);
997  validateEntryExists("get", name_in, foundEntry);
998  return *foundEntry;
999 }
1000 
1001 
1002 inline
1004 ParameterList::getEntryPtr(const std::string& name_in)
1005 {
1007  const Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
1008  if (param_idx != SIOVOCB::getInvalidOrdinal()) {
1009  return &*params_.getNonconstObjPtr(param_idx);
1010  }
1011  return 0;
1012 }
1013 
1014 
1015 inline
1016 const ParameterEntry*
1017 ParameterList::getEntryPtr(const std::string& name_in) const
1018 {
1020  const Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
1021  if (param_idx != SIOVOCB::getInvalidOrdinal()) {
1022  return &*params_.getObjPtr(param_idx);
1023  }
1024  return 0;
1025 }
1026 
1027 
1028 inline RCP<ParameterEntry>
1029 ParameterList::getEntryRCP(const std::string& name_in)
1030 {
1032  const Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
1033  if (param_idx != SIOVOCB::getInvalidOrdinal()) {
1034  return rcpFromPtr(params_.getNonconstObjPtr(param_idx));
1035  }
1036  return null;
1037 }
1038 
1039 
1041 ParameterList::getEntryRCP(const std::string& name_in) const
1042 {
1044  const Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
1045  if (param_idx != SIOVOCB::getInvalidOrdinal()) {
1046  return rcpFromPtr(params_.getObjPtr(param_idx));
1047  }
1048  return null;
1049 }
1050 
1051 
1052 // Attribute Functions
1053 
1054 
1055 inline
1056 const std::string& ParameterList::name() const
1057 {
1058  return name_;
1059 }
1060 
1061 
1062 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1063 template<typename T>
1064 bool ParameterList::isType(const std::string& name_in, T* /*ptr*/) const
1065 {
1067  const Ordinal param_idx = params_.getObjOrdinalIndex(name_in);
1068  if (param_idx != SIOVOCB::getInvalidOrdinal()) {
1069  return params_.getObjPtr(param_idx)->isType<T>();
1070  }
1071  return false;
1072 }
1073 #endif
1074 
1075 
1076 template<typename T>
1077 bool ParameterList::isType(const std::string& name_in) const
1078 {
1079  return this->isType(name_in, static_cast<T*>(0));
1080 }
1081 
1082 
1083 // Read-only access to the iterator
1084 
1085 
1087 {
1088  return params_.begin();
1089 }
1090 
1091 
1093 {
1094  return params_.end();
1095 }
1096 
1097 
1098 inline const std::string& ParameterList::name(ConstIterator i) const
1099 {
1100  return (i->first);
1101 }
1102 
1103 
1105 {
1106  return (i->second);
1107 }
1108 
1109 
1110 // private
1111 
1112 
1113 inline ParameterList::Iterator ParameterList::nonconstBegin()
1114 {
1115  return params_.nonconstBegin();
1116 }
1117 
1118 
1119 inline ParameterList::Iterator ParameterList::nonconstEnd()
1120 {
1121  return params_.nonconstEnd();
1122 }
1123 
1124 
1125 inline ParameterEntry& ParameterList::nonconstEntry(Iterator i)
1126 {
1127  return (i->second);
1128 }
1129 
1130 
1131 template<typename T>
1132 inline
1133 void ParameterList::validateEntryType(
1134  const std::string &/*funcName*/, const std::string &name_in,
1135  const ParameterEntry &entry_in
1136  ) const
1137 {
1139  entry_in.getAny().type() != typeid(T), Exceptions::InvalidParameterType
1140  ,"Error! An attempt was made to access parameter \""<<name_in<<"\""
1141  " of type \""<<entry_in.getAny().typeName()<<"\""
1142  "\nin the parameter (sub)list \""<<this->name()<<"\""
1143  "\nusing the incorrect type \""<<TypeNameTraits<T>::name()<<"\"!"
1144  );
1145 }
1146 
1147 
1148 // //////////////////////////////////////
1149 // Helper functions
1150 
1151 
1158 template<typename T>
1159 T& getParameter( ParameterList& l, const std::string& name )
1160 {
1161  return l.template get<T>(name);
1162 }
1163 
1164 
1170 template<typename T>
1171 inline
1172 T& get( ParameterList& l, const std::string& name )
1173 {
1174  return getParameter<T>(l,name);
1175 }
1176 
1177 
1184 template<typename T>
1185 const T& getParameter( const ParameterList& l, const std::string& name )
1186 {
1187  return l.template get<T>(name);
1188 }
1189 
1190 
1198 template<typename T>
1199 inline
1200 T* getParameterPtr( ParameterList& l, const std::string& name )
1201 {
1202  return l.template getPtr<T>(name);
1203 }
1204 
1205 
1213 template<typename T>
1214 inline
1215 const T* getParameterPtr( const ParameterList& l, const std::string& name )
1216 {
1217  return l.template getPtr<T>(name);
1218 }
1219 
1220 
1227 template<typename T>
1228 inline
1229 bool isParameterType( ParameterList& l, const std::string& name )
1230 {
1231  return l.isType( name, (T*)NULL );
1232 }
1233 
1234 
1241 template<typename T>
1242 inline
1243 bool isParameterType( const ParameterList& l, const std::string& name )
1244 {
1245  return l.isType( name, (T*)NULL );
1246 }
1247 
1248 
1260 template<typename T>
1262  const std::string &paramName
1263  ,const Array<T> &array
1264  ,ParameterList *paramList
1265  )
1266 {
1267  TEUCHOS_TEST_FOR_EXCEPT(!paramList);
1268  paramList->set(paramName,toString(array));
1269 }
1270 
1271 
1336 template<typename T>
1338  const ParameterList &paramList
1339  ,const std::string &paramName
1340  ,const int arrayDim = -1
1341  ,const bool mustExist = true
1342  )
1343 {
1344  std::string arrayStr;
1345  if(mustExist) {
1346  arrayStr = getParameter<std::string>(paramList,paramName);
1347  }
1348  else {
1349  const std::string
1350  *arrayStrPtr = getParameterPtr<std::string>(paramList,paramName);
1351  if(arrayStrPtr) {
1352  arrayStr = *arrayStrPtr;
1353  }
1354  else {
1355  return Array<T>(); // Return an empty array
1356  }
1357  }
1358  Array<T> a;
1359  try {
1360  a = fromStringToArray<T>(arrayStr);
1361  }
1362  catch( const InvalidArrayStringRepresentation&) {
1365  ,"Error! The parameter \""<<paramName<<"\"\n"
1366  "in the sublist \""<<paramList.name()<<"\"\n"
1367  "exists, but the std::string value:\n"
1368  "----------\n"
1369  <<arrayStr<<
1370  "\n----------\n"
1371  "is not a valid array represntation!"
1372  );
1373  }
1375  ( ( a.size()>0 && arrayDim>=0 ) && static_cast<int>(a.size())!=arrayDim )
1377  ,"Error! The parameter \""<<paramName<<"\"\n"
1378  "in the sublist \""<<paramList.name()<<"\"\n"
1379  "exists and is a valid array, but the dimension of\n"
1380  "the read in array a.size() = " << a.size() << "\n"
1381  "was not equal to the expected size arrayDim = " << arrayDim << "!"
1382  );
1383  return a;
1384 }
1385 
1386 
1390 inline
1392  const RCP<ParameterList> &paramList, const std::string& name,
1393  bool mustAlreadyExist = false, const std::string& docString = ""
1394  )
1395 {
1396  return rcpWithEmbeddedObjPostDestroy(
1397  &paramList->sublist(name, mustAlreadyExist, docString), paramList, false );
1398 }
1399 
1400 
1404 inline
1406  const RCP<const ParameterList> &paramList, const std::string& name
1407  )
1408 {
1409  return rcpWithEmbeddedObjPostDestroy(
1410  &paramList->sublist(name), paramList, false );
1411 }
1412 
1413 
1417 inline std::ostream& operator<<(std::ostream& os, const ParameterList& l)
1418 {
1419  return l.print(os);
1420 }
1421 
1422 
1423 } // end of Teuchos namespace
1424 
1425 
1426 #endif
Teuchos::ParameterList::EValidateDefaults
EValidateDefaults
Validation defaults enum.
Definition: Teuchos_ParameterList.hpp:80
Teuchos::TypeNameTraits::name
static std::string name()
Definition: Teuchos_TypeNameTraits.hpp:88
Teuchos::ParameterList::EValidateUsed
EValidateUsed
Validation used enum.
Definition: Teuchos_ParameterList.hpp:68
Teuchos::StringIndexedOrderedValueObjectContainer::getNonconstObjPtr
Ptr< ObjType > getNonconstObjPtr(const Ordinal &idx)
Get a nonconst semi-persisting association with the stored object indexed by ordinal.
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:353
Teuchos_RCP.hpp
Reference-counted pointer class and non-member templated function implementations.
TEUCHOS_TEST_FOR_EXCEPT
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
This macro is designed to be a short version of TEUCHOS_TEST_FOR_EXCEPTION() that is easier to call.
Definition: Teuchos_TestForException.hpp:307
Teuchos::FilteredIterator
C++ Standard Library compatable filtered iterator.
Definition: Teuchos_FilteredIterator.hpp:60
Teuchos::Array::size
size_type size() const
Definition: Teuchos_Array.hpp:1017
Teuchos::ParameterList::getParameterPtr
const T * getParameterPtr(const ParameterList &l, const std::string &name)
A templated helper function for getting a pointer to a parameter from a non-const list,...
Definition: Teuchos_ParameterList.hpp:1215
Teuchos::ParameterList::setName
ParameterList & setName(const std::string &name)
Set the name of *this list.
Definition: Teuchos_ParameterList.hpp:819
Teuchos::ParameterList::getEntryPtr
ParameterEntry * getEntryPtr(const std::string &name)
Retrieves the pointer for an entry with the name name if it exists.
Definition: Teuchos_ParameterList.hpp:1004
Teuchos_ParameterEntry.hpp
Object held as the "value" in the Teuchos::ParameterList std::map.
TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG
#define TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
Definition: Teuchos_TestForException.hpp:246
Teuchos::ParameterList::operator<<
std::ostream & operator<<(std::ostream &os, const ParameterList &l)
Output stream operator for handling the printing of the parameter list.
Definition: Teuchos_ParameterList.hpp:1417
Teuchos::ParameterList::getArrayFromStringParameter
Array< T > getArrayFromStringParameter(const ParameterList &paramList, const std::string &paramName, const int arrayDim=-1, const bool mustExist=true)
Get an Array object (with entries of type T) from a parameter holding a std::string representation of...
Definition: Teuchos_ParameterList.hpp:1337
Teuchos::ParameterEntry::validator
RCP< const ParameterEntryValidator > validator() const
Return the (optional) validator object.
Definition: Teuchos_ParameterEntry.hpp:402
Teuchos::StringIndexedOrderedValueObjectContainer::end
ConstIterator end() const
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:422
Teuchos::ParameterList::end
ConstIterator end() const
An iterator pointing beyond the last entry.
Definition: Teuchos_ParameterList.hpp:1092
Teuchos::ParameterList::createParameterList
RCP< ParameterList > createParameterList(const std::string &name)
Nonmember constructor.
Definition: Teuchos_ParameterList.hpp:762
Teuchos::TypeNameTraits
Default traits class that just returns typeid(T).name().
Definition: Teuchos_TypeNameTraits.hpp:85
Teuchos::ParameterList::get
T & get(const std::string &name, T def_value)
Return the parameter's value, or the default value if it is not there.
Definition: Teuchos_ParameterList.hpp:901
Teuchos::rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Definition: Teuchos_RCPDecl.hpp:1224
Teuchos::ParameterList::createParameterList
RCP< ParameterList > createParameterList()
Nonmember constructor.
Definition: Teuchos_ParameterList.hpp:751
Teuchos::ParameterList::getEntryRCP
RCP< ParameterEntry > getEntryRCP(const std::string &name)
Retrieves the RCP for an entry with the name name if it exists.
Definition: Teuchos_ParameterList.hpp:1029
Teuchos::ParameterList::getParameter
T & getParameter(ParameterList &l, const std::string &name)
A templated helper function for getting a parameter from a non-const list. This helper function preve...
Definition: Teuchos_ParameterList.hpp:1159
Teuchos_Array.hpp
Templated array class derived from the STL std::vector.
Teuchos::StringIndexedOrderedValueObjectContainer::getObjOrdinalIndex
Ordinal getObjOrdinalIndex(const std::string &key) const
Get the ordinal index given the string key.
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:464
Teuchos::InvalidArrayStringRepresentation
Definition: Teuchos_Array.hpp:68
Teuchos::ParameterList::isParameterType
bool isParameterType(const ParameterList &l, const std::string &name)
A templated helper function for determining the type of a parameter entry for a const list....
Definition: Teuchos_ParameterList.hpp:1243
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition: Teuchos_RCPDecl.hpp:429
Teuchos::ParameterList::isParameterType
bool isParameterType(ParameterList &l, const std::string &name)
A templated helper function for determining the type of a parameter entry for a non-const list....
Definition: Teuchos_ParameterList.hpp:1229
Teuchos::Ptr
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Definition: Teuchos_PtrDecl.hpp:104
Teuchos::ParameterList::getParameterPtr
T * getParameterPtr(ParameterList &l, const std::string &name)
A templated helper function for getting a pointer to a parameter from a non-const list,...
Definition: Teuchos_ParameterList.hpp:1200
Teuchos::Array
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
Definition: Teuchos_Array.hpp:72
Teuchos::ParameterList::get
T & get(ParameterList &l, const std::string &name)
A shorter name for getParameter().
Definition: Teuchos_ParameterList.hpp:1172
Teuchos::ParameterList::set
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Set a parameter whose value has type T.
Definition: Teuchos_ParameterList.hpp:831
Teuchos::ParameterList::isType
bool isType(const std::string &name) const
Whether the given parameter exists in this list and has type T.
Definition: Teuchos_ParameterList.hpp:1077
Teuchos::ParameterList::getPtr
T * getPtr(const std::string &name)
Retrieves the pointer for parameter name of type T from a list. A null pointer is returned if this pa...
Definition: Teuchos_ParameterList.hpp:947
Teuchos::ParameterList::sublist
RCP< ParameterList > sublist(const RCP< ParameterList > &paramList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Return a RCP to a sublist in another RCP-ed parameter list.
Definition: Teuchos_ParameterList.hpp:1391
Teuchos::ParameterList::setStringParameterFromArray
void setStringParameterFromArray(const std::string &paramName, const Array< T > &array, ParameterList *paramList)
Set a std::string parameter representation of an array.
Definition: Teuchos_ParameterList.hpp:1261
Teuchos::StringIndexedOrderedValueObjectContainer< ParameterEntry >
Teuchos::ParameterList::setEntry
ParameterList & setEntry(const std::string &name, const ParameterEntry &entry)
Set a parameter directly as a ParameterEntry.
Definition: Teuchos_ParameterList.hpp:890
Teuchos::ParameterList::print
void print() const
Print function to use in debugging in a debugger.
Definition: Teuchos_ParameterList.cpp:291
Teuchos::ParameterList::operator!=
bool operator!=(const ParameterList &list1, const ParameterList &list2)
Returns true if two parameter lists are not the same.
Definition: Teuchos_ParameterList.hpp:793
Teuchos::ParameterList::PrintOptions
Utility class for setting and passing in print options.
Definition: Teuchos_ParameterList.hpp:149
Teuchos::ParameterList::parameterList
RCP< ParameterList > parameterList(const ParameterList &source)
Nonmember constructor.
Definition: Teuchos_ParameterList.hpp:740
Teuchos::ParameterList::ConstIterator
params_t::ConstIterator ConstIterator
Parameter container const iterator typedef.
Definition: Teuchos_ParameterList.hpp:146
Teuchos::ParameterList::parameterList
RCP< ParameterList > parameterList()
Nonmember constructor.
Definition: Teuchos_ParameterList.hpp:718
Teuchos::StringIndexedOrderedValueObjectContainer::nonconstEnd
Iterator nonconstEnd()
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:402
Teuchos::ParameterList::sublist
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Creates an empty sublist and returns a reference to the sublist name. If the list already exists,...
Definition: Teuchos_ParameterList.cpp:239
Teuchos::ParameterList::getEntry
ParameterEntry & getEntry(const std::string &name)
Retrieves an entry with the name name.
Definition: Teuchos_ParameterList.hpp:985
Teuchos::VALIDATE_DEFAULTS_DISABLED
Definition: Teuchos_ParameterList.hpp:84
Teuchos::Exceptions::InvalidParameterValue
Definition: Teuchos_ParameterListExceptions.hpp:79
Teuchos::ParameterList::sublist
RCP< const ParameterList > sublist(const RCP< const ParameterList > &paramList, const std::string &name)
Return a RCP to a sublist in another RCP-ed parameter list.
Definition: Teuchos_ParameterList.hpp:1405
Teuchos::VALIDATE_USED_ENABLED
Definition: Teuchos_ParameterList.hpp:69
Teuchos::ParameterList::getParameter
const T & getParameter(const ParameterList &l, const std::string &name)
A templated helper function for getting a parameter from a const list. This helper function prevents ...
Definition: Teuchos_ParameterList.hpp:1185
Teuchos_map.hpp
Provides std::map class for deficient platforms.
Teuchos::VALIDATE_DEFAULTS_ENABLED
Definition: Teuchos_ParameterList.hpp:81
Teuchos::StringIndexedOrderedValueObjectContainer::nonconstBegin
Iterator nonconstBegin()
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:392
Teuchos::StringIndexedOrderedValueObjectContainerBase
Base types for StringIndexedOrderedValueObjectContainer.
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:59
Teuchos::ParameterList::parameterList
RCP< ParameterList > parameterList(const std::string &name)
Nonmember constructor.
Definition: Teuchos_ParameterList.hpp:729
Teuchos::VALIDATE_USED_DISABLED
Definition: Teuchos_ParameterList.hpp:72
Teuchos::ParameterList::name
const std::string & name() const
The name of this ParameterList.
Definition: Teuchos_ParameterList.hpp:1056
Teuchos::StringIndexedOrderedValueObjectContainer::setObj
Ordinal setObj(const std::string &key, const ObjType &obj)
Set (or reset) object by value and return its ordinal index.
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:476
Teuchos::nonnull
bool nonnull(const std::shared_ptr< T > &p)
Returns true if p.get()!=NULL.
Definition: Teuchos_RCPStdSharedPtrConversionsDecl.hpp:159
Teuchos::ParameterList
A list of parameters of arbitrary type.
Definition: Teuchos_ParameterList.hpp:132
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Teuchos::StringIndexedOrderedValueObjectContainer::begin
ConstIterator begin() const
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:412
Teuchos::ParameterEntry
This object is held as the "value" in the Teuchos::ParameterList std::map.
Definition: Teuchos_ParameterEntry.hpp:67
Teuchos::ParameterList::entry
const ParameterEntry & entry(ConstIterator i) const
Access to ParameterEntry (i.e., returns i->second)
Definition: Teuchos_ParameterList.hpp:1104
Teuchos::StringIndexedOrderedValueObjectContainer::getObjPtr
Ptr< const ObjType > getObjPtr(const Ordinal &idx) const
Get a const semi-persisting association with the stored object indexed by ordinal.
Definition: Teuchos_StringIndexedOrderedValueObjectContainer.hpp:362
Teuchos::ParameterList::begin
ConstIterator begin() const
An iterator pointing to the first entry.
Definition: Teuchos_ParameterList.hpp:1086