10#ifndef TEUCHOS_STANDARDDEPENDENCYXMLCONVERTERS_HPP
11#define TEUCHOS_STANDARDDEPENDENCYXMLCONVERTERS_HPP
83 void convertDependency(
97 static const std::string& getShowIfAttributeName(){
160 void convertDependency(
196 void convertSpecialVisualAttributes(
223 static const std::string& getStringTagName(){
229 static const std::string& getValueAttributeName(){
230 static const std::string valueAttributeName =
"value";
231 return valueAttributeName;
259 void convertSpecialVisualAttributes(
348 "A NumberVisualDependency can only have 1 dependee!" <<
349 std::endl << std::endl);
387 void convertSpecialVisualAttributes(
433 void convertSpecialValidatorAttributes(
458 static const std::string& getPairTag(){
459 static const std::string
pairTag =
"Pair";
464 static const std::string& getValueAttributeName(){
465 static const std::string valueAttributeName =
"value";
466 return valueAttributeName;
470 static const std::string& getValidatorIdAttributeName(){
471 static const std::string validatorIDAttributeName =
"validatorId";
472 return validatorIDAttributeName;
476 static const std::string& getDefaultValidatorIdAttributeName(){
477 static const std::string defaultValidatorIdAttributeName =
478 "defaultValidatorId";
479 return defaultValidatorIdAttributeName;
510 void convertSpecialValidatorAttributes(
530 static const std::string& getFalseValidatorIdAttributeName(){
537 static const std::string& getTrueValidatorIdAttributeName(){
605 static const std::string& getPairTag(){
606 static const std::string
pairTag =
"Pair";
611 static const std::string& getMinAttributeName(){
612 static const std::string minAttributeName =
"min";
613 return minAttributeName;
617 static const std::string& getMaxAttributeName(){
618 static const std::string maxAttributeName =
"max";
619 return maxAttributeName;
624 static const std::string& getValidatorIdAttributeName(){
625 static const std::string validatorIdAttributeName =
"validatorId";
626 return validatorIdAttributeName;
630 static const std::string& getDefaultValidatorIdAttributeName(){
631 static const std::string defaultValidatorIdAttributeName =
632 "defaultValidatorId";
633 return defaultValidatorIdAttributeName;
659 T min =
it->first.first;
660 T max =
it->first.second;
667 pairTag.addAttribute(getMinAttributeName(), min);
668 pairTag.addAttribute(getMaxAttributeName(), max);
680 getDefaultValidatorIdAttributeName(),
694 int result =
xmlObj.findFirstChild(getRangesAndValidatorsTag());
697 "Error: All RangeValidatorDependencies must have a " <<
698 getRangesAndValidatorsTag() <<
" tag!" << std::endl << std::endl);
706 T min =
child.getRequired<
T>(getMinAttributeName());
707 T max =
child.getRequired<
T>(getMaxAttributeName());
710 getValidatorIdAttributeName());
715 "Could not find validator in given ValidatorIDsMap! " << std::endl <<
726 if(
xmlObj.hasAttribute(getDefaultValidatorIdAttributeName())){
729 getDefaultValidatorIdAttributeName());
733 "Could not find a validator (for the default validator) " <<
735 " in the given validatorIDsMap!" << std::endl << std::endl);
747template<
class DependeeType,
class DependentType>
799template<
class DependeeType,
class DependentType>
810 "A ArrayModifierDependency can only have 1 dependee!" <<
811 std::endl << std::endl);
822template<
class DependeeType,
class DependentType>
857template<
class DependeeType,
class DependentType>
874template<
class DependeeType,
class DependentType>
903template<
class DependeeType,
class DependentType>
921template<
class DependeeType,
class DependentType>
949template<
class DependeeType,
class DependentType>
967template<
class DependeeType,
class DependentType>
Converts back and forth between XML and Dependencies.
A database for FunctionObjectXMLConverters.
A collection of standard dependencies.
A collection of Exceptions thrown when converting Dependencys to and from XML.
A converter used to convert ArrayModifierDepdencies to and from xml.
void convertDependency(const RCP< const Dependency > dependency, XMLObject &xmlObj, const XMLParameterListWriter::EntryIDsMap &entryIDsMap, ValidatortoIDMap &validatorIDsMap) const
RCP< Dependency > convertXML(const XMLObject &xmlObj, const Dependency::ConstParameterEntryList dependees, const Dependency::ParameterEntryList dependets, const XMLParameterListReader::EntryIDsMap &entryIDsMap, const IDtoValidatorMap &validatorIDsMap) const
virtual RCP< ArrayModifierDependency< DependeeType, DependentType > > getConcreteDependency(RCP< const ParameterEntry > dependee, Dependency::ParameterEntryList dependents, RCP< const SimpleFunctionObject< DependeeType > > function) const =0
Obtains a concrete ArrayModifierDependency given a dependee, dependtns, and a funciton object.
An xml converter for BoolValidatorDependencies.
An xml converter for BoolVisualDepenencies.
An xml converter for ConditionVisualDependencies.
An abstract base class for converting Dependencies to and from XML.
std::set< RCP< ParameterEntry >, RCPComp > ParameterEntryList
A list of Dependees.
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
static XMLObject convertFunctionObject(RCP< const FunctionObject > function)
Given a FunctionObject, converts the FunctionObject to XML.
static RCP< FunctionObject > convertXML(const XMLObject &xmlObject)
Given an XMLObject, converts the XMLObject to a FunctionObject.
static const std::string & getXMLTagName()
Returns the name of the XML tag used to indicate a funciton object.
Maps Validators to integers.
Thrown when the rangesAndValidators tag for the RangeValidatorDepencyConverter can't be found.
Thrown when converting a dependency that has validaotrs to and from XML. This excetpion indicates tha...
An xml converter for NumberArrayLengthDependencies.
virtual RCP< ArrayModifierDependency< DependeeType, DependentType > > getConcreteDependency(RCP< const ParameterEntry > dependee, Dependency::ParameterEntryList dependents, RCP< const SimpleFunctionObject< DependeeType > > function) const
Obtains a concrete ArrayModifierDependency given a dependee, dependtns, and a funciton object.
An xml converter for NumberVisualDependencies.
void convertSpecialVisualAttributes(RCP< const VisualDependency > dependency, XMLObject &xmlObj, const XMLParameterListWriter::EntryIDsMap &entryIDsMap) const
Smart reference counting pointer class for automatic garbage collection.
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object.
bool nonnull(const RCP< T > &p)
Returns true if p.get()!=NULL.
An xml converter for RangeValidatorDependencies.
void convertSpecialValidatorAttributes(RCP< const ValidatorDependency > dependency, XMLObject &xmlObj, ValidatortoIDMap &validatorIDsMap) const
static const std::string & getRangesAndValidatorsTag()
A RangeValidatorDependency says the following about the relationship between two parameters: Dependen...
std::pair< Range, RCP< const ParameterEntryValidator > > RangeValidatorPair
Convenience typedef.
std::map< Range, RCP< const ParameterEntryValidator > > RangeToValidatorMap
Convenience typedef.
std::pair< T, T > Range
Convenience typedef.
An xml converter for StringValidatorDependencies.
static const std::string & getValuesAndValidatorsTag()
An xml converter for StringVisualDepenencies.
static const std::string & getStringValuesTagName()
Gets the StringValues Tag.
Thrown when a Dependency has too many dependees specified in its XML.
A class for converting TwoDColDependencies to and from XML.
virtual RCP< ArrayModifierDependency< DependeeType, DependentType > > getConcreteDependency(RCP< const ParameterEntry > dependee, Dependency::ParameterEntryList dependents, RCP< const SimpleFunctionObject< DependeeType > > function) const
Obtains a concrete ArrayModifierDependency given a dependee, dependtns, and a funciton object.
A class for converting TwoDRowDependencies to and from XML.
virtual RCP< ArrayModifierDependency< DependeeType, DependentType > > getConcreteDependency(RCP< const ParameterEntry > dependee, Dependency::ParameterEntryList dependents, RCP< const SimpleFunctionObject< DependeeType > > function) const
Obtains a concrete ArrayModifierDependency given a dependee, dependtns, and a funciton object.
An xml converter for ValidatorDependencies.
virtual RCP< ValidatorDependency > convertSpecialValidatorAttributes(const XMLObject &xmlObj, RCP< const ParameterEntry > dependee, const Dependency::ParameterEntryList dependents, const IDtoValidatorMap &validatorIDsMap) const =0
Converts any special aspects of a specific validator dependency from xml.
virtual void convertSpecialValidatorAttributes(RCP< const ValidatorDependency > dependency, XMLObject &xmlObj, ValidatortoIDMap &validatorIDsMap) const =0
Converts any special aspects of a specific validator dependency to xml.
A class for mapping validators to integers.
An xml converter for VisualDepenencies.
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.
virtual RCP< VisualDependency > convertSpecialVisualAttributes(const XMLObject &xmlObj, const Dependency::ConstParameterEntryList dependees, const Dependency::ParameterEntryList dependets, bool showIf, const XMLParameterListReader::EntryIDsMap &entryIDsMap) const =0
Converts any special aspects of a specific visual dependency from xml.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
std::map< ParameterEntry::ParameterEntryID, RCP< ParameterEntry > > EntryIDsMap
Convenience typedef.
std::map< RCP< const ParameterEntry >, ParameterEntry::ParameterEntryID, RCPConstComp > EntryIDsMap
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...