43 #include "Teuchos_StaticSetupMacro.hpp"
55 getConverterMap().insert(
56 ConverterPair(dependency->getTypeAttributeValue(), converterToAdd));
63 ConverterMap::const_iterator it =
67 "Could not find a DependencyXMLConverter for a dependency with "
70 "Try adding an appropriate converter to the DependencyXMLConverterDB " <<
71 "in order to solve this problem." << std::endl << std::endl);
81 ConverterMap::const_iterator it = getConverterMap().find(dependencyType);
82 #ifdef HAVE_TEUCHOS_DEBUG
83 std::ostringstream sout;
86 std::string extraError =
87 #ifdef HAVE_TEUCHOS_DEBUG
95 "Could not find a DependencyXMLConverter for a dependency of type " <<
96 dependencyType <<
"!" << std::endl <<
97 "Try adding an appropriate converter to the DependencyXMLConverterDB " <<
98 "in order to solve this problem." << std::endl << std::endl << extraError
109 dependency, entryIDsMap, validatorIDsMap);
118 fromXMLtoDependency(xmlObject, entryIDsMap, validatorIDsMap);
121 DependencyXMLConverterDB::ConverterMap&
122 DependencyXMLConverterDB::getConverterMap()
124 static ConverterMap masterMap;
135 TEUCHOS_STATIC_SETUP()
146 Teuchos::StringValidatorDependency,
147 Teuchos::StringValidatorDependencyXMLConverter)
149 Teuchos::StringVisualDependency,
150 Teuchos::StringVisualDependencyXMLConverter)
152 Teuchos::BoolValidatorDependency,
153 Teuchos::BoolValidatorDependencyXMLConverter)
155 Teuchos::BoolVisualDependency,
156 Teuchos::BoolVisualDependencyXMLConverter)
158 Teuchos::ConditionVisualDependency,
159 Teuchos::ConditionVisualDependencyXMLConverter)
Maps Validators to integers.
A database for DependencyXMLConverters.
static const std::string & getTypeAttributeName()
Returns the string to be used for the type attribute.
#define TEUCHOS_ADD_RANGE_VALIDATOR_DEP(T)
Adds a RangeValidatorDependencyXMLConverter temeplated on type T to the list of available converters...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
This class represents a depndency between elements in a Parameter List.
#define TEUCHOS_ADD_DEP_CONVERTER(DEP_TYPE, CONVERTER)
Adds converter to the list of DependencyXMLConverters so that all dependencies of DEP_TYPE will be co...
static void printKnownConverters(std::ostream &out)
prints the xml tags associated with all known converters
#define TEUCHOS_ADD_TEMPLATED_NUMBER_DEPS(T)
Adds converters for NumberVisualDepednency, RangeValidatorDepencny, and NumberArrayLengthDependency w...
#define TEUCHOS_ADD_NUMBER_VISUAL_DEP(T)
Adds a NumberVisualDependencyXMLConverter temeplated on type T to the list of available converters...
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object...
std::map< RCP< const ParameterEntry >, ParameterEntry::ParameterEntryID, RCPConstComp > EntryIDsMap
virtual std::string getTypeAttributeValue() const =0
Returns the string to be used for the value of the type attribute when converting the dependency to X...
A class for mapping validators to integers.
static void addConverter(RCP< const Dependency > dependency, RCP< DependencyXMLConverter > converterToAdd)
Add a converter to the database.
std::map< ParameterEntry::ParameterEntryID, RCP< ParameterEntry > > EntryIDsMap
Convenience typedef.
Smart reference counting pointer class for automatic garbage collection.
static RCP< const DependencyXMLConverter > getConverter(const Dependency &dependency)
Get an appropriate DependencyXMLConverter given a ParameterEntry.
static XMLObject convertDependency(RCP< const Dependency > dependency, const XMLParameterListWriter::EntryIDsMap &entryIDsMap, ValidatortoIDMap &validatorIDsMap)
Given a dependency converts the dependency to XML.
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 an appropriate Dependency Converter can't be found.