25 getShowIfAttributeName(), VisualDependency::getShowIfDefaultValue());
43 xmlObj.
addBool(getShowIfAttributeName(), castedDep->getShowIf());
56 "A Validator Dependency can only have 1 dependee!" <<
57 std::endl << std::endl);
59 xmlObj, *(dependees.begin()), dependents, validatorIDsMap);
85 it != valueList.end();
88 XMLObject stringValue(getStringTagName());
105 "A StringVisualDependency can only have 1 dependee!" <<
106 std::endl << std::endl);
114 "StringVisualDependency!" << std::endl <<std::endl);
120 valueList.push_back(child.
getRequired(getValueAttributeName()));
125 *(dependees.begin()),
147 "A BoolVisualDependency can only have 1 dependee!" <<
148 std::endl << std::endl);
150 *(dependees.begin()), dependents, showIf));
162 castedDependency->getCondition(), entryIDsMap));
176 "ConditionVisualDependencies must have a Condition tag!"
194 castedDependency->getValuesAndValidators();
196 StringValidatorDependency::ValueToValidatorMap::const_iterator it =
197 valuesAndValidators.begin();
198 it != valuesAndValidators.end();
202 pairTag.
addAttribute(getValueAttributeName(), it->first);
203 if(validatorIDsMap.
find(it->second) == validatorIDsMap.
end()){
204 validatorIDsMap.
insert(it->second);
207 validatorIDsMap.
find(it->second)->second);
208 valueMapTag.addChild(pairTag);
212 castedDependency->getDefaultValidator();
214 if(validatorIDsMap.
find(defaultVali) == validatorIDsMap.
end()){
215 validatorIDsMap.
insert(defaultVali);
218 getDefaultValidatorIdAttributeName(),
219 validatorIDsMap.
find(defaultVali)->second);
231 int valuesAndValidatorIndex =
236 "Error: All StringValidatorDependencies must have a " <<
240 for(
int i=0; i < valuesAndValidatorTag.
numChildren(); ++i){
242 std::string value = child.
getRequired(getValueAttributeName());
245 getValidatorIdAttributeName());
248 "Could not find a validator corresponding to the ID " << valiID <<
249 " in the given validatorIDsMap!" << std::endl << std::endl);
251 validatorIDsMap.
find(valiID)->second;
252 valueValidatorMap.insert(
257 if(xmlObj.
hasAttribute(getDefaultValidatorIdAttributeName())){
260 getDefaultValidatorIdAttributeName());
262 validatorIDsMap.
find(defaultValiID) == validatorIDsMap.
end(),
264 "Could not find a validator (for the default validator) " <<
265 "corresponding to the ID " << defaultValiID <<
266 " in the given validatorIDsMap!" << std::endl << std::endl);
267 defaultValidator = validatorIDsMap.
find(defaultValiID)->second;
271 dependee, dependents, valueValidatorMap, defaultValidator));
284 castedDependency->getTrueValidator();
286 castedDependency->getFalseValidator();
289 if(validatorIDsMap.
find(castedDependency->getTrueValidator()) ==
290 validatorIDsMap.
end()){
291 validatorIDsMap.
insert(castedDependency->getTrueValidator());
294 getTrueValidatorIdAttributeName(),
295 validatorIDsMap.
find(castedDependency->getTrueValidator())->second);
299 if(validatorIDsMap.
find(falseVali) ==
300 validatorIDsMap.
end()){
301 validatorIDsMap.
insert(falseVali);
304 getFalseValidatorIdAttributeName(),
305 validatorIDsMap.
find(falseVali)->second);
321 if(xmlObj.
hasAttribute(getTrueValidatorIdAttributeName())){
325 getTrueValidatorIdAttributeName());
328 validatorIDsMap.
find(trueID)
330 validatorIDsMap.
end(),
332 "Could not find a Validator for the True validator " <<
333 "with ID " << trueID <<
334 " in the given validatorIDsMap!" << std::endl << std::endl);
337 validatorIDsMap.
find(trueID)->second;
341 if(xmlObj.
hasAttribute(getFalseValidatorIdAttributeName())){
344 getFalseValidatorIdAttributeName());
347 validatorIDsMap.
find(falseID)
349 validatorIDsMap.
end(),
351 "Could not find a Validator for the False validator " <<
352 "with ID " << falseID <<
353 " in the given validatorIDsMap!" << std::endl << std::endl);
356 validatorIDsMap.
find(falseID)->second;
360 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 dependency 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.