57 getShowIfAttributeName(), VisualDependency::getShowIfDefaultValue());
75 xmlObj.
addBool(getShowIfAttributeName(), castedDep->getShowIf());
88 "A Validator Dependency can only have 1 dependee!" <<
89 std::endl << std::endl);
91 xmlObj, *(dependees.begin()), dependents, validatorIDsMap);
117 it != valueList.end();
120 XMLObject stringValue(getStringTagName());
137 "A StringVisualDependency can only have 1 dependee!" <<
138 std::endl << std::endl);
146 "StringVisualDependency!" << std::endl <<std::endl);
152 valueList.push_back(child.
getRequired(getValueAttributeName()));
157 *(dependees.begin()),
179 "A BoolVisualDependency can only have 1 dependee!" <<
180 std::endl << std::endl);
182 *(dependees.begin()), dependents, showIf));
194 castedDependency->getCondition(), entryIDsMap));
208 "ConditionVisualDependencies must have a Condition tag!"
226 castedDependency->getValuesAndValidators();
228 StringValidatorDependency::ValueToValidatorMap::const_iterator it =
229 valuesAndValidators.begin();
230 it != valuesAndValidators.end();
234 pairTag.
addAttribute(getValueAttributeName(), it->first);
235 if(validatorIDsMap.
find(it->second) == validatorIDsMap.
end()){
236 validatorIDsMap.
insert(it->second);
239 validatorIDsMap.
find(it->second)->second);
240 valueMapTag.addChild(pairTag);
244 castedDependency->getDefaultValidator();
246 if(validatorIDsMap.
find(defaultVali) == validatorIDsMap.
end()){
247 validatorIDsMap.
insert(defaultVali);
250 getDefaultValidatorIdAttributeName(),
251 validatorIDsMap.
find(defaultVali)->second);
263 int valuesAndValidatorIndex =
268 "Error: All StringValidatorDependencies must have a " <<
272 for(
int i=0; i < valuesAndValidatorTag.
numChildren(); ++i){
274 std::string value = child.
getRequired(getValueAttributeName());
277 getValidatorIdAttributeName());
280 "Could not find a validator corresponding to the ID " << valiID <<
281 " in the given validatorIDsMap!" << std::endl << std::endl);
283 validatorIDsMap.
find(valiID)->second;
284 valueValidatorMap.insert(
289 if(xmlObj.
hasAttribute(getDefaultValidatorIdAttributeName())){
292 getDefaultValidatorIdAttributeName());
294 validatorIDsMap.
find(defaultValiID) == validatorIDsMap.
end(),
296 "Could not find a validator (for the default validator) " <<
297 "corresponding to the ID " << defaultValiID <<
298 " in the given validatorIDsMap!" << std::endl << std::endl);
299 defaultValidator = validatorIDsMap.
find(defaultValiID)->second;
303 dependee, dependents, valueValidatorMap, defaultValidator));
316 castedDependency->getTrueValidator();
318 castedDependency->getFalseValidator();
321 if(validatorIDsMap.
find(castedDependency->getTrueValidator()) ==
322 validatorIDsMap.
end()){
323 validatorIDsMap.
insert(castedDependency->getTrueValidator());
326 getTrueValidatorIdAttributeName(),
327 validatorIDsMap.
find(castedDependency->getTrueValidator())->second);
331 if(validatorIDsMap.
find(falseVali) ==
332 validatorIDsMap.
end()){
333 validatorIDsMap.
insert(falseVali);
336 getFalseValidatorIdAttributeName(),
337 validatorIDsMap.
find(falseVali)->second);
353 if(xmlObj.
hasAttribute(getTrueValidatorIdAttributeName())){
357 getTrueValidatorIdAttributeName());
360 validatorIDsMap.
find(trueID)
362 validatorIDsMap.
end(),
364 "Could not find a Validator for the True validator " <<
365 "with ID " << trueID <<
366 " in the given validatorIDsMap!" << std::endl << std::endl);
369 validatorIDsMap.
find(trueID)->second;
373 if(xmlObj.
hasAttribute(getFalseValidatorIdAttributeName())){
376 getFalseValidatorIdAttributeName());
379 validatorIDsMap.
find(falseID)
381 validatorIDsMap.
end(),
383 "Could not find a Validator for the False validator " <<
384 "with ID " << falseID <<
385 " in the given validatorIDsMap!" << std::endl << std::endl);
388 validatorIDsMap.
find(falseID)->second;
392 dependee, dependents, trueValidator, falseValidator));
const_iterator find(int id) const
Retrieves and iterator to a validator and id based on the id given.
Maps Validators to integers.
A BoolValidatorDependency says the following about the relationship between two parameters: Dependeni...
std::pair< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorPair
Conveniece typedef.
Thrown when a StringVisualDependency is being converted from XML and no Values tag is found...
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
void addBool(const std::string &name, bool val)
Add a bool as an attribute.
void convertSpecialVisualAttributes(RCP< const VisualDependency > dependency, XMLObject &xmlObj, const XMLParameterListWriter::EntryIDsMap &entryIDsMap) const
An abstract parent class for all visual dependencies.
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::set< RCP< ParameterEntry >, RCPComp > ParameterEntryList
A list of Dependees.
static RCP< Condition > convertXML(const XMLObject &xmlObject, const XMLParameterListReader::EntryIDsMap &entryIDsMap)
Given an XMLObject and IDtoConditionMap, converts the XMLObject to a Condition.
bool nonnull(const std::shared_ptr< T > &p)
Returns true if p.get()!=NULL.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
void addChild(const XMLObject &child)
Add a child node to the node.
static const std::string & getXMLTagName()
static const std::string & getValuesAndValidatorsTag()
std::map< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorMap
Conveniece typedef.
virtual void convertSpecialVisualAttributes(RCP< const VisualDependency > dependency, XMLObject &xmlObj, const XMLParameterListWriter::EntryIDsMap &entryIDsMap) const =0
Converts any special aspects of a specific visual dependency to xml.
static const std::string & getStringValuesTagName()
Gets the StringValues Tag.
void convertDependency(const RCP< const Dependency > dependency, XMLObject &xmlObj, const XMLParameterListWriter::EntryIDsMap &entryIDsMap, ValidatortoIDMap &validatorIDsMap) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
void convertSpecialVisualAttributes(RCP< const VisualDependency > dependency, XMLObject &xmlObj, const XMLParameterListWriter::EntryIDsMap &entryIDsMap) const
void convertDependency(const RCP< const Dependency > dependency, XMLObject &xmlObj, const XMLParameterListWriter::EntryIDsMap &entryIDsMap, ValidatortoIDMap &validatorIDsMap) const
void convertSpecialValidatorAttributes(RCP< const ValidatorDependency > dependency, XMLObject &xmlObj, ValidatortoIDMap &validatorIDsMap) const
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object...
A collection of standard DependencyXMLConverters.
A database for ConditionXMLConverters.
std::map< RCP< const ParameterEntry >, ParameterEntry::ParameterEntryID, RCPConstComp > EntryIDsMap
const_iterator end() const
Returns a const_reference to the end of the map.
void convertSpecialValidatorAttributes(RCP< const ValidatorDependency > dependency, XMLObject &xmlObj, ValidatortoIDMap &validatorIDsMap) const
A class for mapping validators to integers.
void insert(RCP< const ParameterEntryValidator > toInsert)
inserts an IDValidatorPair into the map.
void addAttribute(const std::string &name, T value)
Lookup whether or not Doubles are allowed.
virtual void convertSpecialValidatorAttributes(RCP< const ValidatorDependency > dependency, XMLObject &xmlObj, ValidatortoIDMap &validatorIDsMap) const =0
Converts any special aspects of a specific validator dependency to xml.
const_iterator end() const
Returns a const_reference to the end of the map.
std::vector< std::string >::const_iterator const_iterator
The type of a const forward iterator.
const_iterator find(const RCP< const ParameterEntryValidator > validator) const
Returns an iterator to the validator and id specified by the validator.
std::map< ParameterEntry::ParameterEntryID, RCP< ParameterEntry > > EntryIDsMap
Convenience typedef.
Thrown when a Dependency has too many dependees specified in its XML.
static XMLObject convertCondition(RCP< const Condition > condition, const XMLParameterListWriter::EntryIDsMap &entryIDsMap)
Given a condition and ConditiontoIDMap, converts the condition to XML.
A StringValidatorDependency says the following about the relationship between two parameters: Depende...
int numChildren() const
Return the number of child nodes owned by this node.
void convertSpecialVisualAttributes(RCP< const VisualDependency > dependency, XMLObject &xmlObj, const XMLParameterListWriter::EntryIDsMap &entryIDsMap) const
RCP< Dependency > convertXML(const XMLObject &xmlObj, const Dependency::ConstParameterEntryList dependees, const Dependency::ParameterEntryList dependets, const XMLParameterListReader::EntryIDsMap &entryIDsMap, const IDtoValidatorMap &validatorIDsMap) const
Thrown when converting a StrinvValidatorDependcny from XML and no valuesAndValidators tag is found...
RCP< Dependency > convertXML(const XMLObject &xmlObj, const Dependency::ConstParameterEntryList dependees, const Dependency::ParameterEntryList dependets, const XMLParameterListReader::EntryIDsMap &entryIDsMap, const IDtoValidatorMap &validatorIDsMap) const
An abstract base class for all validator dependencies.
Smart reference counting pointer class for automatic garbage collection.
int findFirstChild(std::string tagName) const
Returns the index of the first child found with the given tag name. Returns -1 if no child is found...
A condition visual dependency says the following about the relationship between elements in a Paramet...
const XMLObject & getChild(int i) const
Return the i-th child node.
bool hasAttribute(const std::string &name) const
Find out if the current node has an attribute of the specified name.
Thrown when converting a dependency that has validaotrs to and from XML. This excetpion indicates tha...
T getWithDefault(const std::string &name, const T &defaultValue) const
Get an attribute, assigning a default value if the requested attribute does not exist.
Thrown when no condtion tag is found when converting a ConditionVisualDependency from XML...
const std::string & getRequired(const std::string &name) const
Get an attribute, throwing an std::exception if it is not found.