45 #include "Teuchos_StandardParameterEntryValidators.hpp"
56 dependentVisible_(false),
65 dependentVisible_(false),
74 dependentVisible_(false),
83 dependentVisible_(false),
88 return dependentVisible_;
97 dependentVisible_ =
true;
100 dependentVisible_ =
false;
139 const std::string& value,
165 return find(values_.
begin(), values_.
end(),
166 getFirstDependeeValue<std::string>()) != values_.
end();
170 return "StringVisualDependency";
176 "Ay no! The dependee of a "
177 "String Visual Dependency must be of type "
180 std::endl << std::endl);
186 std::string blahString =
"blah";
212 return getFirstDependeeValue<bool>();
216 return "BoolVisualDependency";
222 "Ay no! The dependee of a "
223 "Bool Visual Dependency must be of type " <<
226 std::endl << std::endl);
242 condition_(condition)
252 condition_(condition)
262 return condition_->isConditionTrue();
266 return "ConditionVisualDependency";
283 valuesAndValidators_(valuesAndValidators),
284 defaultValidator_(defaultValidator)
295 valuesAndValidators_(valuesAndValidators),
296 defaultValidator_(defaultValidator)
304 return valuesAndValidators_;
310 return defaultValidator_;
314 std::string currentDependeeValue = getFirstDependeeValue<std::string>();
321 valuesAndValidators_.find(currentDependeeValue)
323 valuesAndValidators_.end())
325 (*it)->setValidator(defaultValidator_);
328 (*it)->setValidator(valuesAndValidators_[currentDependeeValue]);
334 return "StringValidatorDependency";
340 "Ay no! The dependee of a "
341 "String Validator Dependency must be of type " <<
344 std::endl << std::endl);
347 valuesAndValidators_.size() < 1,
349 "The valuesAndValidatord map for a string validator dependency must "
350 "have at least one entry!" << std::endl << std::endl);
351 ValueToValidatorMap::const_iterator it = valuesAndValidators_.begin();
356 for(; it != valuesAndValidators_.end(); ++it){
360 "Ay no! All of the validators in a StringValidatorDependency "
361 "must have the same type.");
369 std::string blahString =
"blah";
385 trueValidator_(trueValidator),
386 falseValidator_(falseValidator)
397 trueValidator_(trueValidator),
398 falseValidator_(falseValidator)
404 bool dependeeValue = getFirstDependeeValue<bool>();
411 (*it)->setValidator(trueValidator_)
413 (*it)->setValidator(falseValidator_);
420 return trueValidator_;
426 return falseValidator_;
430 return "BoolValidatorDependency";
438 "Ay no! The dependee of a "
439 "Bool Validator Dependency must be of type " <<
442 std::endl << std::endl);
444 if(!falseValidator_.is_null() && !trueValidator_.is_null()){
450 "Ay no! The true and false validators of a Bool Validator Dependency "
451 "must be the same type! " <<std::endl << std::endl);
RCP< const ParameterEntryValidator > getDefaultValidator() const
static RCP< T > getDummyObject()
Retrieves a dummy object of type T.
A BoolValidatorDependency says the following about the relationship between two parameters: Dependeni...
std::pair< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorPair
Conveniece typedef.
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
An abstract parent class for all visual dependencies.
ParameterEntryList & getDependents()
Gets the dependents of the dependency.
BoolValidatorDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, RCP< const ParameterEntryValidator > trueValidator, RCP< const ParameterEntryValidator > falseValidator=null)
Constructs a BoolValidatorDependency.
A string visual depdencies says the following about the relationship between two elements in a Parame...
A bool visual dependency says the following about the relationship between two elements in a Paramete...
std::string getTypeAttributeValue() const
void validateDep() const
Validates the dependency to make sure it's valid/has been setup properly. If subclassing, this fucntion should be called in the new subclasses constructor.
std::set< RCP< ParameterEntry >, RCPComp > ParameterEntryList
A list of Dependees.
std::string getTypeAttributeValue() const
This object is held as the "value" in the Teuchos::ParameterList std::map.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool getShowIf() const
Get's the value of the showIf variable.
std::string getTypeAttributeValue() const
const ValueToValidatorMap & getValuesAndValidators() const
retrieve a const reference to the ValueToValidator map being used by this StringValidatorDependency ...
T * get() const
Get the raw C++ pointer to the underlying object.
bool getDependeeState() const
VisualDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, bool showIf=getShowIfDefaultValue())
Constructs a VisualDependency.
std::map< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorMap
Conveniece typedef.
This class represents a depndency between elements in a Parameter List.
const ValueList & getValues() const
get the List of values the dependee will be checked against.
RCP< const ParameterEntryValidator > getFalseValidator() const
Gets the false validator.
BoolVisualDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, bool showIf=true)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
StringVisualDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, std::string value, bool showIf=true)
Constructs a StringVisualDependency.
RCP< const ParameterEntryValidator > getTrueValidator() const
Gets the true validator.
bool getDependeeState() const
ValidatorDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent)
Constructs a ValidatorDependency.
A collection of standard dependencies.
RCP< const ParameterEntry > getFirstDependee() const
Gets the first dependee in the dependees list. This is a convience function.
Abstract interface for an object that can validate a ParameterEntry's value.
RCP< const Condition > getCondition() const
Gets the condition being used in this dependency.
Default traits class that just returns typeid(T).name().
Class for retrieving a dummy object of type T.
A StringValidatorDependency says the following about the relationship between two parameters: Depende...
ConditionVisualDependency(RCP< const Condition > condition, RCP< ParameterEntry > dependent, bool showIf=true)
An abstract base class for all validator dependencies.
StringValidatorDependency(RCP< const ParameterEntry > dependee, RCP< ParameterEntry > dependent, ValueToValidatorMap valuesAndValidators, RCP< ParameterEntryValidator > defaultValidator=null)
Constructs a StringValidatorDependency.
Smart reference counting pointer class for automatic garbage collection.
std::string getTypeAttributeValue() const
A condition visual dependency says the following about the relationship between elements in a Paramet...
bool getDependeeState() const
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.
std::string typeName(const T &t)
Template function for returning the concrete type name of a passed-in object.
std::string getTypeAttributeValue() const
void validateDep() const
Validates the dependency to make sure it's valid/has been setup properly. If subclassing, this fucntion should be called in the new subclasses constructor.