Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parameterlist
src
Teuchos_DependencyXMLConverterDB.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_DEPENDENCYXMLCONVERTERDB_HPP
11
#define TEUCHOS_DEPENDENCYXMLCONVERTERDB_HPP
12
16
17
//Must include this and not just DependencyXMLConverter.hpp
18
//because of convience macros
19
#include "
Teuchos_StandardDependencyXMLConverters.hpp
"
20
//Once again, done for the macros.
21
#include "
Teuchos_StandardDependencies.hpp
"
22
#include "
Teuchos_XMLParameterListReader.hpp
"
23
24
25
namespace
Teuchos
{
26
27
class
Dependency
;
28
31
class
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
DependencyXMLConverterDB
{
32
public
:
33
36
43
static
void
addConverter
(
RCP<const Dependency>
dependency,
44
RCP<DependencyXMLConverter>
converterToAdd);
45
47
50
57
static
RCP<const DependencyXMLConverter>
getConverter
(
58
const
Dependency
& dependency);
59
64
static
RCP<const DependencyXMLConverter>
65
getConverter
(
const
XMLObject
& xmlObject);
66
79
static
XMLObject
convertDependency
(
80
RCP<const Dependency>
dependency,
81
const
XMLParameterListWriter::EntryIDsMap
& entryIDsMap,
82
ValidatortoIDMap
& validatorIDsMap);
83
96
static
RCP<Dependency>
convertXML
(
97
const
XMLObject
& xmlObject,
98
const
XMLParameterListReader::EntryIDsMap
& entryIDsMap,
99
const
IDtoValidatorMap
& validatorIDsMap);
100
102
105
111
static
void
printKnownConverters
(std::ostream& out){
112
out <<
"Known DependencyXMLConverters: "
<< std::endl;
113
for
(
114
ConverterMap::const_iterator it = getConverterMap().begin();
115
it != getConverterMap().end();
116
++it)
117
{
118
out <<
"\t"
<< it->first <<std::endl;
119
}
120
}
121
123
124
private
:
125
128
130
typedef
std::map<std::string, RCP<DependencyXMLConverter> > ConverterMap;
131
133
typedef
std::pair<std::string, RCP<DependencyXMLConverter> >
134
ConverterPair;
135
139
static
ConverterMap& getConverterMap();
140
142
143
};
144
145
}
// end namespace Teuchos
146
147
148
//
149
// Helper Macros
150
//
151
156
#define TEUCHOS_ADD_DEP_CONVERTER(DEP_TYPE, CONVERTER) \
157
Teuchos::DependencyXMLConverterDB::addConverter( \
158
Teuchos::DummyObjectGetter< DEP_TYPE >:: \
159
getDummyObject(), \
160
Teuchos::rcp(new CONVERTER));
161
168
#define TEUCHOS_ADD_TEMPLATED_NUMBER_DEPS(T) \
169
TEUCHOS_ADD_NUMBER_VISUAL_DEP(T); \
170
TEUCHOS_ADD_RANGE_VALIDATOR_DEP(T); \
171
TEUCHOS_ADD_ARRAY_MODIFIER_DEP_GROUP(T);
172
177
#define TEUCHOS_ADD_NUMBER_VISUAL_DEP(T) \
178
Teuchos::DependencyXMLConverterDB::addConverter( \
179
Teuchos::DummyObjectGetter<Teuchos::NumberVisualDependency< T > >:: \
180
getDummyObject(), \
181
Teuchos::rcp(new Teuchos::NumberVisualDependencyXMLConverter< T >));
182
187
#define TEUCHOS_ADD_RANGE_VALIDATOR_DEP(T) \
188
Teuchos::DependencyXMLConverterDB::addConverter( \
189
Teuchos::DummyObjectGetter<Teuchos::RangeValidatorDependency< T > >:: \
190
getDummyObject(), \
191
Teuchos::rcp(new Teuchos::RangeValidatorDependencyXMLConverter< T >));
192
196
#define TEUCHOS_ADD_NUMBER_ARRAY_LENGTH_DEP(DEPENDEE_TYPE , DEPENDENT_TYPE) \
197
Teuchos::DependencyXMLConverterDB::addConverter( \
198
Teuchos::DummyObjectGetter<Teuchos::NumberArrayLengthDependency< \
199
DEPENDEE_TYPE , DEPENDENT_TYPE > >::getDummyObject(), \
200
Teuchos::rcp(new Teuchos::NumberArrayLengthDependencyXMLConverter< \
201
DEPENDEE_TYPE , DEPENDENT_TYPE >));
202
207
#define TEUCHOS_ADD_TWODROW_DEP(DEPENDEE_TYPE , DEPENDENT_TYPE) \
208
Teuchos::DependencyXMLConverterDB::addConverter( \
209
Teuchos::DummyObjectGetter<Teuchos::TwoDRowDependency< \
210
DEPENDEE_TYPE , DEPENDENT_TYPE > >::getDummyObject(), \
211
Teuchos::rcp(new Teuchos::TwoDRowDependencyXMLConverter< \
212
DEPENDEE_TYPE , DEPENDENT_TYPE >));
213
217
#define TEUCHOS_ADD_TWODCOL_DEP(DEPENDEE_TYPE , DEPENDENT_TYPE) \
218
Teuchos::DependencyXMLConverterDB::addConverter( \
219
Teuchos::DummyObjectGetter<Teuchos::TwoDColDependency< \
220
DEPENDEE_TYPE , DEPENDENT_TYPE > >::getDummyObject(), \
221
Teuchos::rcp(new Teuchos::TwoDColDependencyXMLConverter< \
222
DEPENDEE_TYPE , DEPENDENT_TYPE >));
223
228
#define TEUCHOS_ADD_ARRAY_MODIFIER_DEP_GROUP(DEPENDEE_TYPE) \
229
TEUCHOS_ADD_NUMBER_ARRAY_LENGTH_DEP( DEPENDEE_TYPE , std::string) \
230
TEUCHOS_ADD_NUMBER_ARRAY_LENGTH_DEP( DEPENDEE_TYPE , int) \
231
TEUCHOS_ADD_NUMBER_ARRAY_LENGTH_DEP( DEPENDEE_TYPE , long long int) \
232
TEUCHOS_ADD_NUMBER_ARRAY_LENGTH_DEP( DEPENDEE_TYPE , double) \
233
TEUCHOS_ADD_NUMBER_ARRAY_LENGTH_DEP( DEPENDEE_TYPE , float) \
234
TEUCHOS_ADD_TWODROW_DEP( DEPENDEE_TYPE , std::string) \
235
TEUCHOS_ADD_TWODROW_DEP( DEPENDEE_TYPE , int) \
236
TEUCHOS_ADD_TWODROW_DEP( DEPENDEE_TYPE , long long int) \
237
TEUCHOS_ADD_TWODROW_DEP( DEPENDEE_TYPE , double) \
238
TEUCHOS_ADD_TWODROW_DEP( DEPENDEE_TYPE , float) \
239
TEUCHOS_ADD_TWODCOL_DEP( DEPENDEE_TYPE , std::string) \
240
TEUCHOS_ADD_TWODCOL_DEP( DEPENDEE_TYPE , int) \
241
TEUCHOS_ADD_TWODCOL_DEP( DEPENDEE_TYPE , long long int) \
242
TEUCHOS_ADD_TWODCOL_DEP( DEPENDEE_TYPE , double) \
243
TEUCHOS_ADD_TWODCOL_DEP( DEPENDEE_TYPE , float)
244
245
246
#endif
// TEUCHOS_DEPENDENCYXMLCONVERTERDB_HPP
Teuchos_StandardDependencies.hpp
A collection of standard dependencies.
Teuchos_StandardDependencyXMLConverters.hpp
A collection of standard DependencyXMLConverters.
Teuchos_XMLParameterListReader.hpp
Writes an XML object to a parameter list.
Teuchos::Dependency
This class represents a depndency between elements in a Parameter List.
Definition
Teuchos_Dependency.hpp:31
Teuchos::DependencyXMLConverterDB
Provides ability to lookup DependencyXMLConverterDB.
Definition
Teuchos_DependencyXMLConverterDB.hpp:31
Teuchos::DependencyXMLConverterDB::convertDependency
static XMLObject convertDependency(RCP< const Dependency > dependency, const XMLParameterListWriter::EntryIDsMap &entryIDsMap, ValidatortoIDMap &validatorIDsMap)
Given a dependency converts the dependency to XML.
Definition
Teuchos_DependencyXMLConverterDB.cpp:71
Teuchos::DependencyXMLConverterDB::addConverter
static void addConverter(RCP< const Dependency > dependency, RCP< DependencyXMLConverter > converterToAdd)
Add a converter to the database.
Definition
Teuchos_DependencyXMLConverterDB.cpp:19
Teuchos::DependencyXMLConverterDB::printKnownConverters
static void printKnownConverters(std::ostream &out)
prints the xml tags associated with all known converters
Definition
Teuchos_DependencyXMLConverterDB.hpp:111
Teuchos::DependencyXMLConverterDB::getConverter
static RCP< const DependencyXMLConverter > getConverter(const Dependency &dependency)
Get an appropriate DependencyXMLConverter given a ParameterEntry.
Definition
Teuchos_DependencyXMLConverterDB.cpp:29
Teuchos::DependencyXMLConverterDB::convertXML
static RCP< Dependency > convertXML(const XMLObject &xmlObject, const XMLParameterListReader::EntryIDsMap &entryIDsMap, const IDtoValidatorMap &validatorIDsMap)
Given an XMLObject converts the XMLObject to a Dependency.
Definition
Teuchos_DependencyXMLConverterDB.cpp:80
Teuchos::IDtoValidatorMap
Maps Validators to integers.
Definition
Teuchos_ValidatorMaps.hpp:24
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition
Teuchos_RCPDecl.hpp:397
Teuchos::ValidatortoIDMap
A class for mapping validators to integers.
Definition
Teuchos_ValidatorMaps.hpp:71
Teuchos::XMLObject
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
Definition
Teuchos_XMLObject.hpp:30
Teuchos::XMLParameterListReader::EntryIDsMap
std::map< ParameterEntry::ParameterEntryID, RCP< ParameterEntry > > EntryIDsMap
Convenience typedef.
Definition
Teuchos_XMLParameterListReader.hpp:40
Teuchos::XMLParameterListWriter::EntryIDsMap
std::map< RCP< const ParameterEntry >, ParameterEntry::ParameterEntryID, RCPConstComp > EntryIDsMap
Definition
Teuchos_XMLParameterListWriter.hpp:41
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0