Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_StandardParameterEntryXMLConverters.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Teuchos: Common Tools Package
4//
5// Copyright 2004 NTESS and the Teuchos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TEUCHOS_STANDARDPARAMETERENTRYXMLCONVERTERS_HPP
11#define TEUCHOS_STANDARDPARAMETERENTRYXMLCONVERTERS_HPP
12
18#include "Teuchos_ParameterEntryXMLConverter.hpp"
19
20
21namespace Teuchos {
22
23
29class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT AnyParameterEntryConverter : public ParameterEntryXMLConverter{
30
31public:
32
35
37 const std::string getTypeAttributeValue() const;
38
40 const std::string getValueAttributeValue(
41 RCP<const ParameterEntry> entry) const;
42
44 any getAny(const XMLObject& xmlObj) const;
46
47};
48
49
54template<class T>
57{
58
59public:
60
63
65 virtual const std::string getTypeAttributeValue() const{
67 }
68
70 virtual const std::string getValueAttributeValue(
71 RCP<const ParameterEntry> entry) const {
72 return toString(any_cast<T>(entry->getAny(false)));
73 }
74
76 any getAny(const XMLObject& xmlObj) const{
77 return any(xmlObj.getRequired<T>(getValueAttributeName()));
78 }
79
81
82};
83
84
85
86} // namespace Teuchos
87
88
89#endif // TEUCHOS_STANDARDPARAMETERENTRYXMLCONVERTERS_HPP
A last resort converter for when no others will do.
A class used to convert parameter entries to xml and vice versa.
Smart reference counting pointer class for automatic garbage collection.
A standard ParameterEntryXMLConverter for most data types.
virtual const std::string getValueAttributeValue(RCP< const ParameterEntry > entry) const
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
Modified boost::any class, which is a container for a templated value.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...