Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_FunctionObjectXMLConverterDB.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_FUNTIONOBJECTXMLCONVERTERDB_HPP
11 #define TEUCHOS_FUNTIONOBJECTXMLCONVERTERDB_HPP
12 
17 // All includes needed for convience macros below
21 
22 
23 namespace Teuchos {
24 
29 
30 public:
31 
34 
41  static void addConverter(
43  RCP<FunctionObjectXMLConverter> converterToAdd);
44 
46 
49 
59  getConverter(const FunctionObject& function);
60 
68  getConverter(const XMLObject& xmlObject);
69 
77  static XMLObject convertFunctionObject(RCP<const FunctionObject> function);
78 
87  static RCP<FunctionObject> convertXML(const XMLObject& xmlObject);
89 
92 
98  static void printKnownConverters(std::ostream& out){
99  out << "Known ConditionXMLConverters: " << std::endl;
100  for(
101  ConverterMap::const_iterator it = getConverterMap().begin();
102  it != getConverterMap().end();
103  ++it)
104  {
105  out << "\t" << it->first <<std::endl;
106  }
107  }
108 
110 
111 private:
112 
115 
117  typedef std::map<std::string, RCP<FunctionObjectXMLConverter> > ConverterMap;
118 
120  typedef std::pair<std::string, RCP<FunctionObjectXMLConverter> > ConverterPair;
121 
125  static ConverterMap& getConverterMap();
126 
128 
129 };
130 
131 
132 } // end namespace Teuchos
133 
134 //
135 // Helper Macros
136 //
137 
141 #define TEUCHOS_ADD_SIMPLEFUNCTIONCONVERTERS(T) \
142  Teuchos::FunctionObjectXMLConverterDB::addConverter( \
143  Teuchos::rcp(new Teuchos::SubtractionFunction< T >), \
144  Teuchos::DummyObjectGetter<Teuchos::SubtractionFunctionXMLConverter< T > >:: \
145  getDummyObject()); \
146  \
147  Teuchos::FunctionObjectXMLConverterDB::addConverter( \
148  Teuchos::rcp(new Teuchos::AdditionFunction< T >), \
149  Teuchos::DummyObjectGetter<Teuchos::AdditionFunctionXMLConverter< T > >:: \
150  getDummyObject()); \
151  \
152  Teuchos::FunctionObjectXMLConverterDB::addConverter( \
153  Teuchos::rcp(new Teuchos::MultiplicationFunction< T >), \
154  Teuchos::DummyObjectGetter<Teuchos::MultiplicationFunctionXMLConverter< T > >:: \
155  getDummyObject()); \
156  \
157  Teuchos::FunctionObjectXMLConverterDB::addConverter( \
158  Teuchos::rcp(new Teuchos::DivisionFunction< T >), \
159  Teuchos::DummyObjectGetter<Teuchos::DivisionFunctionXMLConverter< T > >:: \
160  getDummyObject()); \
161  \
162 
163 #endif // TEUCHOS_FUNTIONOBJECTXMLCONVERTERDB_HPP
A collection of standard FunctionObjectXMLConverters.
std::pair< std::string, RCP< FunctionObjectXMLConverter > > ConverterPair
convience typedef.
Provides ability to lookup FunctionObjectXMLConverters.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object...
#define TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
static void printKnownConverters(std::ostream &out)
prints the xml tags associated with all known converters
Smart reference counting pointer class for automatic garbage collection.
A function object represents an arbitrary function.
std::map< std::string, RCP< FunctionObjectXMLConverter > > ConverterMap
convience class.