Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_StandardDependencies.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_STANDARDDEPENDCIES_HPP_
11#define TEUCHOS_STANDARDDEPENDCIES_HPP_
12
16
17#include "Teuchos_Dependency.hpp"
18#include "Teuchos_StandardParameterEntryValidators.hpp"
20#include "Teuchos_StandardFunctionObjects.hpp"
23
24
25namespace Teuchos{
26
27
38class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT VisualDependency : public Dependency{
39
40public:
41
43 static const bool& getShowIfDefaultValue(){
44 static const bool SHOW_IF_DEFAULT_VALUE = true;
45 return SHOW_IF_DEFAULT_VALUE;
46 }
47
48
51
62 RCP<ParameterEntry> dependent,
63 bool showIf=getShowIfDefaultValue());
64
75 ParameterEntryList dependents,
76 bool showIf=getShowIfDefaultValue());
77
88 RCP<ParameterEntry> dependent,
89 bool showIf=getShowIfDefaultValue());
90
100 ConstParameterEntryList dependees,
101 ParameterEntryList dependents,
102 bool showIf=getShowIfDefaultValue());
103
105
107
108
115 virtual bool getDependeeState() const = 0;
116
120 bool isDependentVisible() const;
121
123 bool getShowIf() const;
124
126
129
131 void evaluate();
132
134
135private:
136
139
143 bool dependentVisible_;
144
149 bool showIf_;
150
152
153};
154
158class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT ValidatorDependency : public Dependency{
159
160public:
161
164
173 RCP<ParameterEntry> dependent);
174
183 ParameterEntryList dependents);
184
186
189
191 virtual void evaluate() = 0;
192
194
195};
196
210class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT StringVisualDependency : public VisualDependency{
211
212public:
213
216
221
223
226
242 RCP<ParameterEntry> dependent,
243 std::string value,
244 bool showIf=true);
245
261 RCP<ParameterEntry> dependent,
262 const ValueList& values,
263 bool showIf=true);
264
281 const std::string& value,
282 bool showIf=true);
283
301 const ValueList& values,
302 bool showIf=true);
303
305
308
310 const ValueList& getValues() const;
311
313
316
318 bool getDependeeState() const;
319
321
324
326 std::string getTypeAttributeValue() const;
327
329
330protected:
331
334
336 void validateDep() const;
337
339
340private:
341
344
348 const ValueList values_;
349
351
352};
353
354
360template<>
361class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT DummyObjectGetter<StringVisualDependency>{
362
363public:
364
367
372
374
375};
376
377
391class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT BoolVisualDependency : public VisualDependency{
392
393public:
394
397
409 RCP<ParameterEntry> dependent,
410 bool showIf=true);
411
424 bool showIf=true);
425
427
430
432 bool getDependeeState() const;
433
435
438
440 std::string getTypeAttributeValue() const;
441
443
444protected:
445
448
450 void validateDep() const;
451
453
454};
455
456
462template<>
463class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT DummyObjectGetter<BoolVisualDependency>{
464
465public:
466
469
474
476
477};
478
495class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT ConditionVisualDependency : public VisualDependency{
496
497public:
498
501
514 RCP<const Condition> condition,
515 RCP<ParameterEntry> dependent,
516 bool showIf=true);
517
529 RCP<const Condition> condition,
531 bool showIf=true);
532
534
537
540
543
545 bool getDependeeState() const;
546
548
551
553 std::string getTypeAttributeValue() const;
554
556
557protected:
558
561
563 void validateDep() const {}
564
566
567
568private:
569
572
576 RCP<const Condition> condition_;
577
579
580};
581
582
588template<>
589class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT DummyObjectGetter<ConditionVisualDependency>{
590
591public:
592
595
599
601
602};
603
604
625template <class T>
627
628public:
629
632
655 RCP<ParameterEntry> dependent,
656 bool showIf=true,
657 RCP<SimpleFunctionObject<T> > func=null);
658
681 ParameterEntryList dependents,
682 bool showIf=true,
683 RCP<SimpleFunctionObject<T> > func=null);
684
686
689
690 bool getDependeeState() const;
691
693
696
698 std::string getTypeAttributeValue() const;
699
701
704
707
709
710protected:
711
714
716 void validateDep() const;
717
719
720private:
721
724
730
732 //
733};
734
735template<class T>
738 RCP<ParameterEntry> dependent,
739 bool showIf,
741 :VisualDependency(dependee, dependent, showIf),
742 func_(func)
743{
744 validateDep();
745}
746
747template<class T>
750 ParameterEntryList dependents,
751 bool showIf,
753 :VisualDependency(dependee, dependents, showIf),
754 func_(func)
755{
756 validateDep();
757}
758
759template<class T>
761 T value = getFirstDependeeValue<T>();
762 if(!func_.is_null()){
763 value = func_->runFunction(value);
764 }
765 return value > ScalarTraits<T>::zero() ? true : false;
766}
767
768template<class T>
770 return "NumberVisualDependency(" + TypeNameTraits<T>::name() + ")";
771}
772
773template<class T>
776{
777 return func_.getConst();
778}
779
780template<class T>
784 !dependee->isType<T>(),
786 "The dependee of a " <<
787 "Number Visual Dependency must the same type as the dependency's " <<
788 "template type!" << std::endl <<
789 "Type Encountered: " << dependee->getAny().typeName() << std::endl <<
790 "Template Type: " << TypeNameTraits<T>::name() << std::endl <<
791 std::endl);
792}
793
794
800template<class T>
802
803public:
804
807
812
814
815};
816
817template<class T>
825
830template<class DependeeType, class DependentType>
832public:
833
836
846 RCP<ParameterEntry> dependent,
847 RCP<const SimpleFunctionObject<DependeeType> > func=null);
848
858 ParameterEntryList dependents,
859 RCP<const SimpleFunctionObject<DependeeType> > func=null);
860
862
865
874 {
875 return func_;
876 }
877
879
882
884 virtual void evaluate();
885
886protected:
887
889 virtual void validateDep() const;
890
892
895
903 virtual void modifyArray(
904 DependeeType newAmount,
905 RCP<ParameterEntry> dependentToModify) = 0;
906
914 virtual std::string getBadDependentValueErrorMessage() const=0;
915
917private:
918
921
926
927 //}
928};
929
930template<class DependeeType, class DependentType>
938
939template<class DependeeType, class DependentType>
947
948template<class DependeeType, class DependentType>
951 typeid(DependeeType) != getFirstDependee()->getAny().type(),
953 "Ay no! The dependee parameter types don't match." << std::endl <<
954 "Dependee Template Type: " << TypeNameTraits<DependeeType>::name() <<
955 std::endl <<
956 "Dependee Parameter Type: " << getFirstDependee()->getAny().typeName()
957 << std::endl << std::endl);
958}
959
960template<class DependeeType, class DependentType>
962 DependeeType newAmount = Dependency::getFirstDependeeValue<DependeeType>();
963 if(!this->getFunctionObject().is_null()){
964 newAmount = this->getFunctionObject()->runFunction(newAmount);
965 }
966
970
971 for(
972 Dependency::ParameterEntryList::iterator it = this->getDependents().begin();
973 it != this->getDependents().end();
974 ++it)
975 {
976 modifyArray(newAmount, *it);
977 }
978}
979
980
1003template<class DependeeType, class DependentType>
1005 public ArrayModifierDependency<DependeeType, DependentType>
1006{
1007
1008public:
1009
1012
1023 RCP<ParameterEntry> dependent,
1024 RCP<const SimpleFunctionObject<DependeeType> > func=null);
1025
1037 RCP<const SimpleFunctionObject<DependeeType> > func=null);
1038
1040
1043
1045 std::string getTypeAttributeValue() const;
1046
1048
1049protected:
1050
1053
1054 virtual void validateDep() const;
1055
1057 void modifyArray(
1058 DependeeType newAmount, RCP<ParameterEntry> dependentToModify);
1059
1061 std::string getBadDependentValueErrorMessage() const;
1062
1064
1065};
1066
1067template<class DependeeType, class DependentType>
1070 RCP<ParameterEntry> dependent,
1072 ArrayModifierDependency<DependeeType, DependentType>(dependee, dependent, func)
1073{
1074 validateDep();
1075}
1076
1077template<class DependeeType, class DependentType>
1086
1087
1088template<class DependeeType, class DependentType>
1089std::string
1097
1098template <class DependeeType, class DependentType>
1099void
1101 DependeeType newAmount, RCP<ParameterEntry> dependentToModify)
1102{
1103 const Array<DependentType> originalArray =
1104 any_cast<Array<DependentType> >(dependentToModify->getAny());
1105 Array<DependentType> newArray(newAmount);
1106 DependeeType i;
1107 for(
1109 i<originalArray.size() && i<newAmount;
1110 ++i)
1111 {
1112 newArray[i] = originalArray[i];
1113 }
1114
1115 dependentToModify->setValue(newArray,
1116 false, dependentToModify->docString(), dependentToModify->validator());
1117}
1118
1119template<class DependeeType, class DependentType>
1120std::string
1122 std::ostringstream os;
1123 os <<
1124 "Ruh Roh Shaggy! Looks like a dependency tried to set the length "
1125 "of the Array(s) to a negative number. Silly. You can't have "
1126 "an Array with a negative length!" << std::endl << std::endl <<
1127 "Error:" << std::endl <<
1128 "An attempt was made to set the length of an Array to a negative "
1129 "number by a NumberArrayLengthDependency" << std::endl << std::endl;
1130 return os.str();
1131}
1132
1133template<class DependeeType, class DependentType>
1134void
1136 const
1137{
1139 for(
1140 Dependency::ConstParameterEntryList::const_iterator it =
1141 this->getDependents().begin();
1142 it != this->getDependents().end();
1143 ++it)
1144 {
1146 typeid(Teuchos::Array<DependentType>) != (*it)->getAny().type(),
1148 "Ay no! The dependent parameter types don't match." << std::endl <<
1149 "Dependent Template Type: " <<
1150 TypeNameTraits<DependentType>::name() << std::endl <<
1151 "Dependent Parameter Type: " <<
1152 (*it)->getAny().typeName() << std::endl << std::endl);
1153 }
1154}
1155
1161template<class DependeeType, class DependentType>
1162class DummyObjectGetter<NumberArrayLengthDependency<DependeeType, DependentType> >{
1163
1164public:
1165
1168
1174
1176
1177};
1178
1179template<class DependeeType, class DependentType>
1188
1213class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT StringValidatorDependency : public ValidatorDependency{
1214
1215public:
1216
1219
1223 typedef std::map<std::string, RCP<const ParameterEntryValidator> >
1225
1229 typedef std::pair<std::string, RCP<const ParameterEntryValidator> >
1231
1233
1236
1252 RCP<ParameterEntry> dependent,
1253 ValueToValidatorMap valuesAndValidators,
1254 RCP<ParameterEntryValidator> defaultValidator=null);
1255
1272 ValueToValidatorMap valuesAndValidators,
1273 RCP<ParameterEntryValidator> defaultValidator = null);
1274
1276
1279
1283
1286
1288
1291
1293 void evaluate();
1294
1296
1299
1301 std::string getTypeAttributeValue() const;
1302
1304
1305protected:
1306
1309
1310 void validateDep() const;
1311
1313
1314private:
1315
1318
1323 ValueToValidatorMap valuesAndValidators_;
1324
1330 RCP<ParameterEntryValidator> defaultValidator_;
1331
1333
1334};
1335
1336
1342template<>
1343class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT DummyObjectGetter<StringValidatorDependency>{
1344
1345public:
1346
1349
1353
1355
1356};
1357
1373class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT BoolValidatorDependency : public ValidatorDependency{
1374
1375public:
1376
1379
1392 RCP<ParameterEntry> dependent,
1394 RCP<const ParameterEntryValidator> falseValidator=null);
1395
1410 RCP<const ParameterEntryValidator> falseValidator=null);
1411
1413
1416
1417 void evaluate();
1418
1420
1423
1426
1429
1431
1434
1436 std::string getTypeAttributeValue() const;
1437
1439
1440protected:
1441
1444
1445 void validateDep() const;
1446
1448
1449private:
1450
1453
1458 RCP<const ParameterEntryValidator> trueValidator_, falseValidator_;
1459
1461
1462};
1463
1469template<>
1470class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT DummyObjectGetter<BoolValidatorDependency>{
1471
1472public:
1473
1476
1479
1481
1482};
1483
1513template<class T>
1515
1516public:
1517
1520
1524 typedef std::pair<T,T> Range;
1525
1529 typedef std::map<Range, RCP<const ParameterEntryValidator> >
1531
1535 typedef std::pair<Range, RCP<const ParameterEntryValidator> >
1537
1539
1542
1558 RCP<ParameterEntry> dependent,
1559 RangeToValidatorMap rangesAndValidators,
1560 RCP<const ParameterEntryValidator> defaultValidator=null);
1561
1578 RangeToValidatorMap rangesAndValidators,
1579 RCP<const ParameterEntryValidator> defaultValidator=null);
1580
1582
1585
1588 return rangesAndValidators_;
1589 }
1590
1593 return defaultValidator_;
1594 }
1595
1597
1600
1602 void evaluate();
1603
1605
1608
1610 std::string getTypeAttributeValue() const;
1611
1613
1614protected:
1615
1618
1620 void validateDep() const;
1621
1623
1624
1625private:
1626
1629
1633 RangeToValidatorMap rangesAndValidators_;
1634
1635 void setDependentsToValidator(RCP<const ParameterEntryValidator> toSet);
1636
1637 RCP<const ParameterEntryValidator> defaultValidator_;
1638
1640
1641};
1642
1643template<class T>
1646 RCP<ParameterEntry> dependent,
1647 RangeToValidatorMap rangesAndValidators,
1648 RCP<const ParameterEntryValidator> defaultValidator)
1649 :ValidatorDependency(dependee, dependent),
1650 rangesAndValidators_(rangesAndValidators),
1651 defaultValidator_(defaultValidator)
1652{
1653 validateDep();
1654}
1655
1656template<class T>
1660 RangeToValidatorMap rangesAndValidators,
1661 RCP<const ParameterEntryValidator> defaultValidator)
1662 :ValidatorDependency(dependee, dependents),
1663 rangesAndValidators_(rangesAndValidators),
1664 defaultValidator_(defaultValidator)
1665{
1666 validateDep();
1667}
1668
1669template<class T>
1671{
1672 return "RangeValidatorDependency(" + TypeNameTraits<T>::name() + ")";
1673}
1674
1675
1676template<class T>
1678 typename RangeToValidatorMap::const_iterator it;
1679 T dependeeValue = getFirstDependeeValue<T>();
1680 for(
1681 it = rangesAndValidators_.begin();
1682 it != rangesAndValidators_.end();
1683 ++it)
1684 {
1685 T min = it->first.first;
1686 T max = it->first.second;
1687 if(dependeeValue >= min && dependeeValue <max){
1688 setDependentsToValidator(it->second);
1689 return;
1690 }
1691 }
1692 setDependentsToValidator(defaultValidator_);
1693}
1694
1695template<class T>
1698 TEUCHOS_TEST_FOR_EXCEPTION(dependee->getAny().type() != typeid(T),
1700 "The dependee of a RangeValidatorDependency must be the same type as " <<
1701 "The RangeValidatorDependency template type!" << std::endl <<
1702 "Dependee Type: " << dependee->getAny().typeName() << std::endl <<
1703 "Templated Type: " << TypeNameTraits<T>::name() << std::endl << std::endl);
1704
1706 rangesAndValidators_.size() < 1,
1708 "The rangesAndValidators map RangeValidatorDependency "
1709 "must have at least one entry!" << std::endl << std::endl);
1710
1711 typename RangeToValidatorMap::const_iterator it =
1712 rangesAndValidators_.begin();
1713 RCP<const ParameterEntryValidator> firstValidator = it->second;
1714 // getting the raw pointer avoids a Clang warning about side effects in typeid
1715 const ParameterEntryValidator* rawValidatorPtr = firstValidator.get();
1716 ++it;
1717 for(; it!=rangesAndValidators_.end(); ++it){
1718 TEUCHOS_TEST_FOR_EXCEPTION( typeid(*rawValidatorPtr) != typeid(*(it->second)),
1720 "Ay no! All of the validators in a RangeValidatorDependency "
1721 "must have the same type.");
1723 it->first.first > it->first.second,
1725 "The Range " << it->first.first << " to " << it->first.second <<
1726 " is invalid. The min can't be greater than the max, you silly goose!"
1727 );
1728 }
1729
1731 nonnull(defaultValidator_)
1732 &&
1733 typeid(*rawValidatorPtr) != typeid(*defaultValidator_),
1735 "Ay no! The default validator of a RangeValidatorDependency "
1736 "must have the same type as the validators in rangesAndValidators map."
1737 );
1738
1739}
1740
1741template<class T>
1742void RangeValidatorDependency<T>::setDependentsToValidator(
1744{
1745 typename ParameterEntryList::const_iterator it;
1746 for(
1747 it = getDependents().begin();
1748 it != getDependents().end();
1749 ++it)
1750 {
1751 (*it)->setValidator(toSet);
1752 }
1753}
1754
1760template<class T>
1762
1763public:
1764
1767
1772
1774
1775};
1776
1777template<class T>
1793
1798template<class DependeeType, class DependentType>
1800 public ArrayModifierDependency<DependeeType, DependentType>
1801{
1802
1803public:
1804
1807
1818 RCP<ParameterEntry> dependent,
1819 RCP<const SimpleFunctionObject<DependeeType> > func=null):
1820 ArrayModifierDependency<DependeeType, DependentType>(
1821 dependee,
1822 dependent,
1823 func)
1824 {}
1825
1826
1838 RCP<const SimpleFunctionObject<DependeeType> > func=null):
1839 ArrayModifierDependency<DependeeType, DependentType>(
1840 dependee,
1841 dependents,
1842 func)
1843 {}
1844
1846
1847protected:
1848
1851
1852 virtual void validateDep() const;
1853
1855
1856};
1857
1858template<class DependeeType, class DependentType>
1859void
1861 const
1862{
1864 for(
1865 Dependency::ConstParameterEntryList::const_iterator it =
1866 this->getDependents().begin();
1867 it != this->getDependents().end();
1868 ++it)
1869 {
1871 typeid(Teuchos::TwoDArray<DependentType>) != (*it)->getAny().type(),
1873 "Ay no! The dependent parameter types don't match." << std::endl <<
1874 "Dependent Template Type: " <<
1875 TypeNameTraits<DependentType>::name() << std::endl <<
1876 "Dependent Parameter Type: " <<
1877 (*it)->getAny().typeName() << std::endl << std::endl);
1878 }
1879}
1880
1881
1889template<class DependeeType, class DependentType>
1891 public TwoDArrayModifierDependency<DependeeType, DependentType>
1892{
1893
1894public:
1895
1898
1909 RCP<ParameterEntry> dependent,
1910 RCP<const SimpleFunctionObject<DependeeType> > func=null);
1911
1912
1924 RCP<const SimpleFunctionObject<DependeeType> > func=null);
1925
1927
1930
1932 std::string getTypeAttributeValue() const;
1933
1935
1936protected:
1937
1940
1942 void modifyArray(
1943 DependeeType newAmount, RCP<ParameterEntry> dependentToModify);
1944
1946 std::string getBadDependentValueErrorMessage() const;
1948
1949};
1950
1951template<class DependeeType, class DependentType>
1954 RCP<ParameterEntry> dependent,
1956 TwoDArrayModifierDependency<DependeeType, DependentType>(
1957 dependee, dependent, func)
1958{
1959 this->validateDep();
1960}
1961
1962template<class DependeeType, class DependentType>
1967 TwoDArrayModifierDependency<DependeeType, DependentType>(
1968 dependee, dependents, func)
1969{
1970 this->validateDep();
1971}
1972
1973
1974template<class DependeeType, class DependentType>
1975std::string
1983
1984template <class DependeeType, class DependentType>
1985void
1987 DependeeType newAmount,
1988 RCP<ParameterEntry> dependentToModify)
1989{
1990 TwoDArray<DependentType> originalArray =
1991 any_cast<TwoDArray<DependentType> >(dependentToModify->getAny());
1992 originalArray.resizeRows(newAmount);
1993 dependentToModify->setValue(originalArray,
1994 false, dependentToModify->docString(), dependentToModify->validator());
1995}
1996
1997template<class DependeeType, class DependentType>
1998std::string
2000 std::ostringstream os;
2001 os <<
2002 "Ruh Roh Shaggy! Looks like a dependency tried to set the number of "
2003 "rows in TwoDArray(s) to a negative number. Silly. You can't have "
2004 "a TwoDArray with a negative number of rows!" << std::endl << std::endl <<
2005 "Error:" << std::endl <<
2006 "An attempt was made to set the number of rows of a TwoDArray to a negative "
2007 "number by a TwoDRowDependency" << std::endl << std::endl;
2008 return os.str();
2009}
2010
2016template<class DependeeType, class DependentType>
2017class DummyObjectGetter<TwoDRowDependency<DependeeType, DependentType> >{
2018
2019public:
2020
2023
2029
2031
2032};
2033
2034template<class DependeeType, class DependentType>
2043
2044
2052template<class DependeeType, class DependentType>
2054 public TwoDArrayModifierDependency<DependeeType, DependentType>
2055{
2056
2057public:
2058
2061
2072 RCP<ParameterEntry> dependent,
2073 RCP<const SimpleFunctionObject<DependeeType> > func=null);
2074
2075
2087 RCP<const SimpleFunctionObject<DependeeType> > func=null);
2088
2090
2093
2095 std::string getTypeAttributeValue() const;
2096
2098
2099protected:
2100
2103
2105 void modifyArray(
2106 DependeeType newAmount, RCP<ParameterEntry> dependentToModify);
2107
2109 std::string getBadDependentValueErrorMessage() const;
2111
2112};
2113
2114template<class DependeeType, class DependentType>
2117 RCP<ParameterEntry> dependent,
2119 TwoDArrayModifierDependency<DependeeType, DependentType>(
2120 dependee, dependent, func)
2121{
2122 this->validateDep();
2123}
2124
2125template<class DependeeType, class DependentType>
2130 TwoDArrayModifierDependency<DependeeType, DependentType>(
2131 dependee, dependents, func)
2132{
2133 this->validateDep();
2134}
2135
2136
2137template<class DependeeType, class DependentType>
2138std::string
2146
2147template <class DependeeType, class DependentType>
2148void
2150 DependeeType newAmount,
2151 RCP<ParameterEntry> dependentToModify)
2152{
2153 TwoDArray<DependentType> originalArray =
2154 any_cast<TwoDArray<DependentType> >(dependentToModify->getAny());
2155 originalArray.resizeCols(newAmount);
2156 dependentToModify->setValue(originalArray,
2157 false, dependentToModify->docString(), dependentToModify->validator());
2158}
2159
2160template<class DependeeType, class DependentType>
2161std::string
2163 std::ostringstream os;
2164 os <<
2165 "Ruh Roh Shaggy! Looks like a dependency tried to set the number of "
2166 "cols in TwoDArray(s) to a negative number. Silly. You can't have "
2167 "a TwoDArray with a negative number of cols!" << std::endl << std::endl <<
2168 "Error:" << std::endl <<
2169 "An attempt was made to set the number of columns of a TwoDArrayArray to a negative "
2170 "number by a TwoDColDependency" << std::endl << std::endl;
2171 return os.str();
2172}
2173
2179template<class DependeeType, class DependentType>
2180class DummyObjectGetter<TwoDColDependency<DependeeType, DependentType> >{
2181
2182public:
2183
2186
2192
2194
2195};
2196
2197template<class DependeeType, class DependentType>
2206
2207
2208
2209} //namespace Teuchos
2210#endif //TEUCHOS_STANDARDDEPENDCIES_HPP_
Defines basic traits for the ordinal field type.
Defines basic traits for the scalar field type.
Standard Conditions to be used.
ArrayModifierDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, RCP< const SimpleFunctionObject< DependeeType > > func=null)
Constructs an ArrayModifierDependency.
virtual void modifyArray(DependeeType newAmount, RCP< ParameterEntry > dependentToModify)=0
Modifies a particular attribute of the array according to the specific semantics of the dependency.
virtual std::string getBadDependentValueErrorMessage() const =0
Returns the error message that should be displayed if the dependent has taken on a value that,...
RCP< const SimpleFunctionObject< DependeeType > > getFunctionObject() const
Retrieves the function being used to calculate the amount by which an arrays dimensional attribute sh...
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
size_type size() const
A BoolValidatorDependency says the following about the relationship between two parameters: Dependeni...
BoolValidatorDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, RCP< const ParameterEntryValidator > trueValidator, RCP< const ParameterEntryValidator > falseValidator=null)
Constructs a BoolValidatorDependency.
RCP< const ParameterEntryValidator > getTrueValidator() const
Gets the true validator.
void validateDep() const
Validates the dependency to make sure it's valid/has been setup properly. If subclassing,...
RCP< const ParameterEntryValidator > getFalseValidator() const
Gets the false validator.
A bool visual dependency says the following about the relationship between two elements in a Paramete...
BoolVisualDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, bool showIf=true)
A condition visual dependency says the following about the relationship between elements in a Paramet...
ConditionVisualDependency(RCP< const Condition > condition, RCP< ParameterEntry > dependent, bool showIf=true)
RCP< const Condition > getCondition() const
Gets the condition being used in this dependency.
ParameterEntryList & getDependents()
Gets the dependents of the dependency.
Dependency(ConstParameterEntryList dependees, ParameterEntryList dependents)
Constructs a Dependency.
std::set< RCP< ParameterEntry >, RCPComp > ParameterEntryList
A list of Dependees.
S getFirstDependeeValue() const
Convienence function. Returns the first dependee in the list of dependees.
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
RCP< const ParameterEntry > getFirstDependee() const
Gets the first dependee in the dependees list. This is a convience function.
static RCP< BoolValidatorDependency > getDummyObject()
Retrieves a dummy object of type BoolValidatorDependency.
static RCP< BoolVisualDependency > getDummyObject()
Retrieves a dummy object of type BoolVisualDependency.
static RCP< ConditionVisualDependency > getDummyObject()
Retrieves a dummy object of type ConditionVisualDependency.
static RCP< NumberArrayLengthDependency< DependeeType, DependentType > > getDummyObject()
Retrieves a dummy object of type NumberArrayLengthDependency.
static RCP< NumberVisualDependency< T > > getDummyObject()
Retrieves a dummy object of type NumberVisualDependency.
static RCP< RangeValidatorDependency< T > > getDummyObject()
Retrieves a dummy object of type RangeValidatorDependency.
static RCP< StringValidatorDependency > getDummyObject()
Retrieves a dummy object of type StringValidatorDependency.
static RCP< StringVisualDependency > getDummyObject()
Retrieves a dummy object of type StringVisualDependency.
static RCP< TwoDColDependency< DependeeType, DependentType > > getDummyObject()
Retrieves a dummy object of type NumberArrayLengthDependency.
static RCP< TwoDRowDependency< DependeeType, DependentType > > getDummyObject()
Retrieves a dummy object of type NumberArrayLengthDependency.
Class for retrieving a dummy object of type T.
static RCP< T > getDummyObject()
Retrieves a dummy object of type T.
A NumberArrayLengthDependency says the following about the relationship between two parameters: The l...
NumberArrayLengthDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, RCP< const SimpleFunctionObject< DependeeType > > func=null)
Constructs a NumberArrayLengthDependency.
void modifyArray(DependeeType newAmount, RCP< ParameterEntry > dependentToModify)
A number visual dependency says the following about the relationship between two elements in a Parame...
bool getDependeeState() const
Get the state of the dependee in order to evaluate the dependency.
NumberVisualDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, bool showIf=true, RCP< SimpleFunctionObject< T > > func=null)
Constructs a NumberVisualDependency.
RCP< const SimpleFunctionObject< T > > getFunctionObject() const
Const version of function getter.
Abstract interface for an object that can validate a ParameterEntry's value.
This object is held as the "value" in the Teuchos::ParameterList std::map.
Smart reference counting pointer class for automatic garbage collection.
RCP< const T > getConst() const
Return an RCP<const T> version of *this.
T * get() const
Get the raw C++ pointer to the underlying object.
A RangeValidatorDependency says the following about the relationship between two parameters: Dependen...
std::pair< Range, RCP< const ParameterEntryValidator > > RangeValidatorPair
Convenience typedef.
const RangeToValidatorMap & getRangeToValidatorMap() const
RangeValidatorDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, RangeToValidatorMap rangesAndValidators, RCP< const ParameterEntryValidator > defaultValidator=null)
Constructs a RangeValidatorDependency.
RCP< const ParameterEntryValidator > getDefaultValidator() const
std::map< Range, RCP< const ParameterEntryValidator > > RangeToValidatorMap
Convenience typedef.
std::pair< T, T > Range
Convenience typedef.
A simple function object that applies a given operand to a spcified arguement using a specific operat...
A StringValidatorDependency says the following about the relationship between two parameters: Depende...
void validateDep() const
Validates the dependency to make sure it's valid/has been setup properly. If subclassing,...
const ValueToValidatorMap & getValuesAndValidators() const
retrieve a const reference to the ValueToValidator map being used by this StringValidatorDependency
RCP< const ParameterEntryValidator > getDefaultValidator() const
std::pair< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorPair
Conveniece typedef.
StringValidatorDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, ValueToValidatorMap valuesAndValidators, RCP< ParameterEntryValidator > defaultValidator=null)
Constructs a StringValidatorDependency.
std::map< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorMap
Conveniece typedef.
A string visual dependency says the following about the relationship between two elements in a Parame...
const ValueList & getValues() const
get the List of values the dependee will be checked against.
StringVisualDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, std::string value, bool showIf=true)
Constructs a StringVisualDependency.
TwoDArrayModifierDependency(RCP< const ParameterEntry > dependee, Dependency::ParameterEntryList dependents, RCP< const SimpleFunctionObject< DependeeType > > func=null)
Constructs a TwoDArrayModifierDependency.
TwoDArrayModifierDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, RCP< const SimpleFunctionObject< DependeeType > > func=null)
Constructs a TwoDArrayModifierDependency.
A thin wrapper around the Array class which causes it to be interpreted as a 2D Array.
void resizeRows(size_type numberOfRows)
Changes the number of rows in the matrix.
void resizeCols(size_type numberOfCols)
Changes the number of rows in the matrix.
A dependency in which the number of rows in a parameter with a TwoDArray depends on the value of anot...
TwoDColDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, RCP< const SimpleFunctionObject< DependeeType > > func=null)
Constructs a TwoDColDependency.
void modifyArray(DependeeType newAmount, RCP< ParameterEntry > dependentToModify)
A dependency in which the number of rows in a parameter with a TwoDArray depends on the value of anot...
void modifyArray(DependeeType newAmount, RCP< ParameterEntry > dependentToModify)
TwoDRowDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, RCP< const SimpleFunctionObject< DependeeType > > func=null)
Constructs a TwoDRowDependency.
ValidatorDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent)
Constructs a ValidatorDependency.
bool isDependentVisible() const
Determines whether or not the dependent is currently visible.
virtual bool getDependeeState() const =0
Get the state of the dependee in order to evaluate the dependency.
bool getShowIf() const
Get's the value of the showIf variable.
VisualDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, bool showIf=getShowIfDefaultValue())
Constructs a VisualDependency.
ValueType & any_cast(any &operand)
Used to extract the templated value held in Teuchos::any to a given value type.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
bool nonnull(const std::shared_ptr< T > &p)
Returns true if p.get()!=NULL.
std::string typeName(const T &t)
Template function for returning the concrete type name of a passed-in object.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
static T zero()
Returns representation of zero for this ordinal type.
static T one()
Returns representation of one for this scalar type.
static T zero()
Returns representation of zero for this scalar type.