43#ifndef TEUCHOS_STANDARDVALIDATORXMLCONVERTERS_HPP
44#define TEUCHOS_STANDARDVALIDATORXMLCONVERTERS_HPP
51#include "Teuchos_StandardParameterEntryValidators.hpp"
98template<
class IntegralType>
119 #ifdef HAVE_TEUCHOS_DEBUG
136 static const std::string& getIntegralValueAttributeName() {
142 static const std::string& getStringTagName() {
148 static const std::string& getStringValueAttributeName() {
154 static const std::string& getStringDocAttributeName() {
160 static const std::string& getDefaultParameterAttributeName() {
162 "defaultParameterName";
167 static const std::string& getCaseSensitiveAttributeName() {
183template<
class IntegralType>
192 for (
int i=0;
i<
xmlObj.numChildren(); ++
i) {
196 "Error converting xmlObject to "
197 "StringToIntegralParameterEntryValidator." << std::endl <<
200 if (
currentChild.hasAttribute(getIntegralValueAttributeName())) {
203 getIntegralValueAttributeName()));
205 if (
currentChild.hasAttribute(getStringDocAttributeName())) {
207 currentChild.getRequired<std::string>(getStringDocAttributeName()));
211 xmlObj.getRequired(getDefaultParameterAttributeName());
215 xmlObj.getWithDefault<
bool> (getCaseSensitiveAttributeName (),
true);
230template<
class IntegralType>
252 stringTag.addAttribute(getIntegralValueAttributeName(),
260 xmlObj.addAttribute(getDefaultParameterAttributeName(),
267 xmlObj.addAttribute(getIntegralValueAttributeName(),
294 void convertValidator(
299 #ifdef HAVE_TEUCHOS_DEBUG
344 void convertValidator(
349 #ifdef HAVE_TEUCHOS_DEBUG
362 static const std::string& getAllowIntAttributeName() {
368 static const std::string& getAllowDoubleAttributeName() {
374 static const std::string& getAllowStringAttributeName() {
380 static const std::string& getPrefferedTypeAttributeName() {
424#ifdef HAVE_TEUCHOS_DEBUG
439 static const std::string& getMinAttributeName() {
445 static const std::string& getMaxAttributeName() {
451 static const std::string& getStepAttributeName() {
457 static const std::string& getPrecisionAttributeName() {
475 T step =
xmlObj.getWithDefault(
478 unsigned short int precision =
xmlObj.getWithDefault(
479 getPrecisionAttributeName(),
482 if (
xmlObj.hasAttribute(getMinAttributeName())) {
485 if (
xmlObj.hasAttribute(getMaxAttributeName())) {
507 xmlObj.addAttribute<
short unsigned int>(
540 void convertValidator(
545 #ifdef HAVE_TEUCHOS_DEBUG
558 static const std::string& getFileMustExistAttributeName() {
596 void convertValidator(
601 #ifdef HAVE_TEUCHOS_DEBUG
614 static const std::string& getStringTagName() {
620 static const std::string& getStringValueAttributeName() {
629template<
class Val
idatorType,
class EntryType>
642 void convertValidator(
662template<
class Val
idatorType,
class EntryType>
663RCP<ParameterEntryValidator>
664AbstractArrayValidatorXMLConverter<ValidatorType, EntryType>::convertXML(
665 const XMLObject& xmlObj,
666 const IDtoValidatorMap& validatorIDsMap)
const
675 getPrototypeIdAttributeName()));
682 MissingValidatorDefinitionException,
683 "Could not find prototype validator with id: "
685 getPrototypeIdAttributeName()) << std::endl<< std::endl);
696template<
class Val
idatorType,
class EntryType>
698AbstractArrayValidatorXMLConverter<ValidatorType, EntryType>::convertValidator(
699 const RCP<const ParameterEntryValidator> validator,
701 const ValidatortoIDMap& validatorIDsMap)
const
748template<
class Val
idatorType,
class EntryType>
750 public AbstractArrayValidatorXMLConverter<ValidatorType, EntryType>
761#ifdef HAVE_TEUCHOS_DEBUG
800template<
class Val
idatorType,
class EntryType>
802 public AbstractArrayValidatorXMLConverter<ValidatorType, EntryType>
815#ifdef HAVE_TEUCHOS_DEBUG
A database for ValidatorXMLConverters.
Converts back and forth between XML and ParameterEntryValidators.
Writes an XML object to a parameter list.
Converts AnyNumberParameterEntryValidators to and from XML.
Converts ArrayValidators to and from XML.
Thrown when xml tag is encountered that is either unrecognized or inappropriate for a given context.
Converts BoolParameterEntryValidators to and from XML.
Class for retrieving a dummy object of type T.
Class defining the traits of the number type being used in an EnhancedNumberValidator.
Converts EnhancedNumberValidators to and from XML.
void convertValidator(const RCP< const ParameterEntryValidator > validator, XMLObject &xmlObj, const ValidatortoIDMap &validatorIDsMap) const
RCP< ParameterEntryValidator > convertXML(const XMLObject &xmlObj, const IDtoValidatorMap &validatorIDsMap) const
Converts FileNameValidators to and from XML.
Maps Validators to integers.
ValidatorMap::const_iterator const_iterator
Smart reference counting pointer class for automatic garbage collection.
RCP< T2 > rcp_dynamic_cast(const RCP< T1 > &p1, bool throw_on_fail=false)
Dynamic cast of underlying RCP type from T1* to T2*.
RCP(ENull null_arg=null)
Initialize RCP<T> to NULL.
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 is_null() const
Returns true if the underlying pointer is null.
Convert a StringToIntegralParameterEntryValidator to and from XML.
RCP< ParameterEntryValidator > convertXML(const XMLObject &xmlObj, const IDtoValidatorMap &validatorIDsMap) const
void convertValidator(const RCP< const ParameterEntryValidator > validator, XMLObject &xmlObj, const ValidatortoIDMap &validatorIDsMap) const
Converts StringValidators to and from XML.
Converts TwoDArrayValidators to and from XML.
Default traits class that just returns typeid(T).name().
static XMLObject convertValidator(RCP< const ParameterEntryValidator > validator, const ValidatortoIDMap &validatorIDsMap, bool assignedID=true)
Given a validator converts the validator to XML.
static RCP< ParameterEntryValidator > convertXML(const XMLObject &xmlObject, const IDtoValidatorMap &validatorIDsMap)
Given an XMLObject converts the XMLObject to a ParameterEntryValidator and inserts the validator into...
An abstract base class for converting ParameterEntryValidators to and from XML.
static const std::string & getPrototypeIdAttributeName()
A class for mapping validators to integers.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
#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,...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.