Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_ConditionXMLConverterDB.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_CONDITIONXMLCONVERTERDB_HPP
11 #define TEUCHOS_CONDITIONXMLCONVERTERDB_HPP
12 
17 // Both includes needed for convience macros below
20 
21 
22 namespace Teuchos {
23 
24 class Condition;
25 
29 
30 public:
31 
34 
41  static void addConverter(RCP<const Condition> condition,
42  RCP<ConditionXMLConverter> converterToAdd);
43 
45 
48 
58  getConverter(const Condition& condition);
59 
67  getConverter(const XMLObject& xmlObject);
68 
79  static XMLObject convertCondition(
80  RCP<const Condition> condition,
81  const XMLParameterListWriter::EntryIDsMap& entryIDsMap);
82 
93  static RCP<Condition> convertXML(
94  const XMLObject& xmlObject,
95  const XMLParameterListReader::EntryIDsMap& entryIDsMap);
96 
98 
101 
107  static void printKnownConverters(std::ostream& out){
108  out << "Known ConditionXMLConverters: " << std::endl;
109  for(
110  ConverterMap::const_iterator it = getConverterMap().begin();
111  it != getConverterMap().end();
112  ++it)
113  {
114  out << "\t" << it->first <<std::endl;
115  }
116  }
117 
119 
120 private:
121 
124 
126  typedef std::map<std::string, RCP<ConditionXMLConverter> > ConverterMap;
127 
129  typedef std::pair<std::string, RCP<ConditionXMLConverter> > ConverterPair;
130 
134  static ConverterMap& getConverterMap();
135 
137 
138 };
139 
140 
141 } // end namespace Teuchos
142 
143 //
144 // Helper Macros
145 //
146 
148 #define TEUCHOS_ADD_NUMBERCONDITION_CONVERTER(T) \
149  Teuchos::ConditionXMLConverterDB::addConverter( \
150  Teuchos::DummyObjectGetter<Teuchos::NumberCondition< T > >:: \
151  getDummyObject(), \
152  Teuchos::rcp(new Teuchos::NumberConditionConverter< T >));
153 
154 #endif // TEUCHOS_CONDITIONXMLCONVERTERDB_HPP
Provides ability to lookup ConditionXMLConverters.
static void printKnownConverters(std::ostream &out)
prints the xml tags associated with all known converters
std::pair< std::string, RCP< ConditionXMLConverter > > ConverterPair
convience typedef.
std::map< std::string, RCP< ConditionXMLConverter > > ConverterMap
convience class.
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
#define TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
std::map< ParameterEntry::ParameterEntryID, RCP< ParameterEntry > > EntryIDsMap
Convenience typedef.
A Condition determines whether or not a particular set of conditions are currently occuring...
Smart reference counting pointer class for automatic garbage collection.
A collection of standard ConditionXMLConverters.
Standard Conditions to be used.