45 #include "Teuchos_StandardParameterEntryValidators.hpp" 46 #ifdef TEUCHOS_HAVE_QT 83 return dependentVisible_;
92 dependentVisible_ =
true;
95 dependentVisible_ =
false;
134 const std::string& value,
160 return find(values_.
begin(), values_.
end(),
161 getFirstDependeeValue<std::string>()) != values_.
end();
165 return "StringVisualDependency";
171 "Ay no! The dependee of a " 172 "String Visual Dependency must be of type " 175 std::endl << std::endl);
181 std::string blahString =
"blah";
207 return getFirstDependeeValue<bool>();
211 return "BoolVisualDependency";
217 "Ay no! The dependee of a " 218 "Bool Visual Dependency must be of type " <<
221 std::endl << std::endl);
237 condition_(condition)
247 condition_(condition)
257 return condition_->isConditionTrue();
261 return "ConditionVisualDependency";
278 valuesAndValidators_(valuesAndValidators),
279 defaultValidator_(defaultValidator)
290 valuesAndValidators_(valuesAndValidators),
291 defaultValidator_(defaultValidator)
299 return valuesAndValidators_;
305 return defaultValidator_;
309 std::string currentDependeeValue = getFirstDependeeValue<std::string>();
316 valuesAndValidators_.find(currentDependeeValue)
318 valuesAndValidators_.end())
320 (*it)->setValidator(defaultValidator_);
323 (*it)->setValidator(valuesAndValidators_[currentDependeeValue]);
329 return "StringValidatorDependency";
335 "Ay no! The dependee of a " 336 "String Validator Dependency must be of type " <<
339 std::endl << std::endl);
342 valuesAndValidators_.size() < 1,
344 "The valuesAndValidatord map for a string validator dependency must " 345 "have at least one entry!" << std::endl << std::endl);
346 ValueToValidatorMap::const_iterator it = valuesAndValidators_.begin();
349 for(; it != valuesAndValidators_.end(); ++it){
352 "Ay no! All of the validators in a StringValidatorDependency " 353 "must have the same type.");
361 std::string blahString =
"blah";
377 trueValidator_(trueValidator),
378 falseValidator_(falseValidator)
389 trueValidator_(trueValidator),
390 falseValidator_(falseValidator)
396 bool dependeeValue = getFirstDependeeValue<bool>();
403 (*it)->setValidator(trueValidator_)
405 (*it)->setValidator(falseValidator_);
412 return trueValidator_;
418 return falseValidator_;
422 return "BoolValidatorDependency";
430 "Ay no! The dependee of a " 431 "Bool Validator Dependency must be of type " <<
434 std::endl << std::endl);
436 if(!falseValidator_.is_null() && !trueValidator_.is_null()){
439 "Ay no! The true and false validators of a Bool Validator Dependency " 440 "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.
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.
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 ...
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.
virtual bool getDependeeState() const =0
Get the state of the dependee in order to evaluate the dependency.
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.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos, as well as a number of utility routines.
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
bool getDependeeState() const
bool isDependentVisible() const
Determines whether or not the dependent is currently visible.
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.