54 : _allowDuplicateSublists(true)
71 "XMLParameterListReader expected tag " <<
73 <<
", found " << xml.
getTag());
78 if(validatorsIndex != -1){
86 if(dependencyIndex != -1){
105 "XMLParameterListReader expected tag " <<
107 <<
", found " << xml.
getTag());
110 int validatorsIndex =
112 if(validatorsIndex != -1){
125 std::set<const XMLObject*> validatorsWithPrototypes;
130 validatorsWithPrototypes.insert(&xml.
getChild(i));
147 std::set<const XMLObject*>::const_iterator it =
148 validatorsWithPrototypes.begin();
149 it!=validatorsWithPrototypes.end();
159 xmlID, insertedValidator));
172 "XMLParameterListReader expected tag " <<
195 "XMLParameterListReader expected tag "
198 << child.
getTag() <<
" tag.");
215 std::ostringstream ss;
222 parentList->isSublist(name) ==
true,
224 "XMLParameterListReader encountered duplicate sublist \"" << name <<
"\", in violation"
225 <<
" of the policy specified by XMLParameterListReader::setAllowsDuplicateSublists()." );
233 "All child nodes of a ParameterList must have a name attribute!" <<
234 std::endl << std::endl);
236 parentList->setEntry(
244 "Could not find validator with id: "
248 "Bad Parameter: " << name << std::endl << std::endl);
249 parentList->getEntryRCP(name)->setValidator(result->second);
265 "Validators with duplicate ids found!" << std::endl <<
266 "Bad ID: " << potentialNewID);
284 depSheet->addDependency(currentDep);
300 "Parameters/ParameterList with duplicate ids found!" << std::endl <<
301 "Bad ID: " << xmlID << std::endl << std::endl);
302 entryIDsMap.insert(EntryIDsMap::value_type(xmlID, entryToInsert));
const_iterator find(int id) const
Retrieves and iterator to a validator and id based on the id given.
Writes an XML object to a parameter list.
static const std::string & getIdAttributeName()
const std::string & getTag() const
Return the tag of the current node.
Maps Validators to integers.
bool getAllowsDuplicateSublists() const
Specifies the current policy regarding duplicated sublists. See setAllowsDuplicateSublists() for more...
A database for DependencyXMLConverters.
Optionally thrown when a sublist is set twice by either updateParametersFromXmlFile(), updateParametersFromXmlFileAndUpdate() or updateParametersFromXmlString()
static const std::string & getTagName()
Get the string that should be used as the tag name for all parameters when they are serialized to xml...
ValidatorMap::const_iterator const_iterator
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
static const std::string & getValidatorsTagName()
bool _allowDuplicateSublists
static const std::string & getIdAttributeName()
Thrown when a parameter entry tag is missing it's name attribute.
static const std::string & getPrototypeIdAttributeName()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
void convertDependencies(RCP< DependencySheet > depSheet, const XMLObject &xml, const EntryIDsMap &entryIDsMap, const IDtoValidatorMap &validatorIDsMap) const
Write the given XML object to appropriate dependencies.
void testForDuplicateValidatorIDs(ParameterEntryValidator::ValidatorID potentialNewID, const IDtoValidatorMap ¤tMap) const
Tests to see if there are duplicate validator IDs.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object...
Thrown when an element inside a parameter list is bad.
static const std::string & getDependenciesTagName()
A database for ValidatorXMLConverters.
Writes a ParameterList to an XML object.
RCP< ParameterList > toParameterList(const XMLObject &xml, RCP< DependencySheet > depSheet) const
const_iterator end() const
Returns a const_reference to the end of the map.
A list of parameters of arbitrary type.
static RCP< ParameterEntryValidator > convertXML(const XMLObject &xmlObject, const IDtoValidatorMap &validatorIDsMap)
Given an XMLObject converts the XMLObject to a ParameterEntryValidator and inserts the validator into...
unsigned int ParameterEntryID
void convertValidators(const XMLObject &xml, IDtoValidatorMap &validatorIDsMap) const
Write the given XML object to appropriate validators.
std::map< ParameterEntry::ParameterEntryID, RCP< ParameterEntry > > EntryIDsMap
Convenience typedef.
static ParameterEntry convertXML(const XMLObject &xmlObj)
Converts XML to a ParameterEntry.
Thrown when the root xml tag for a parameter list is incorrect.
std::pair< ParameterEntryValidator::ValidatorID, RCP< ParameterEntryValidator > > IDValidatorPair
int numChildren() const
Return the number of child nodes owned by this node.
const std::string & getAttribute(const std::string &name) const
Return the value of the attribute with the specified name.
Thrown when two parameters in an XML file have the same ID.
Constructs a CantFindParameterEntryConverterException.
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...
void convertParameterList(const XMLObject &xml, RCP< ParameterList > parentList, EntryIDsMap &entryIDsMap, const IDtoValidatorMap &validatorIDsMap) const
Write the given XML object to a parameter list along with the validators located in the given map...
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.
static const std::string & getParameterListTagName()
static const std::string & getNameAttributeName()
void insertEntryIntoMap(const XMLObject &xmlObj, RCP< ParameterEntry > entryToInsert, EntryIDsMap &entryIDsMap) const
static RCP< Dependency > convertXML(const XMLObject &xmlObject, const XMLParameterListReader::EntryIDsMap &entryIDsMap, const IDtoValidatorMap &validatorIDsMap)
Given an XMLObject converts the XMLObject to a Dependency.
const std::string & getRequired(const std::string &name) const
Get an attribute, throwing an std::exception if it is not found.
Thrown when a referenced validator can't be found.
void insert(IDValidatorPair toInsert)
inserts an IDValidatorPair into the map.
static const std::string & getNameAttributeName()
When serializing to XML, this string should be used as the name of the name attribute.
void setAllowsDuplicateSublists(bool policy)
Set policy regarding duplicated sublists.