3 #include <Poco/DOM/Node.h>
5 #include "util/TypeMappingParser.h"
6 #include "util/XmlTypeMappingParserHelper.h"
17 template <
typename TechType>
21 const std::string &mappingGroup,
22 const std::string &techNode,
23 Poco::Logger &logger);
37 virtual TechType
parseTechType(
const Poco::XML::Node &node) = 0;
42 virtual std::string
techTypeRepr(
const TechType &type) = 0;
48 template <
typename TechType>
50 const std::string &mappingGroup,
51 const std::string &techNode,
52 Poco::Logger &logger):
53 m_helper(mappingGroup, techNode, logger)
57 template <
typename TechType>
61 std::pair<Poco::AutoPtr<Poco::XML::Node>,
ModuleType> mapping;
63 if (logger().trace()) {
65 "loading DOM representation of type mappings",
69 m_helper.parseDOM(in);
71 while (!(mapping = m_helper.next()).first.isNull()) {
72 const TechType techType = parseTechType(*mapping.first);
74 if (logger().debug()) {
76 "parsed mapping " + techTypeRepr(techType)
77 +
" to " + mapping.second.type().toString(),
81 sequence.emplace_back(techType, mapping.second);
std::vector< TypeMapping > TypeMappingSequence
Sequence of particular mappings.
Definition: TypeMappingParser.h:28
TypeMappingParser is an abstract class providing method parse() that reads a given definition file (i...
Definition: TypeMappingParser.h:17
virtual TechType parseTechType(const Poco::XML::Node &node)=0
Parse the XML node describing a technology-specific data type.
XmlTypeMappingParser is an abstract specialization of the TypeMappingParser. It is used to parse an e...
Definition: XmlTypeMappingParser.h:18
virtual std::string techTypeRepr(const TechType &type)=0
Definition: ModuleType.h:18
Definition: Loggable.h:19
TypeMappingParser< TechType >::TypeMappingSequence parse(std::istream &in) override
Parse the input stream as XML file via the XmlTypeMappingParserHelper.
Definition: XmlTypeMappingParser.h:58
Helper defining method for parsing an input stream as an XML input. The purpose is to extract informa...
Definition: XmlTypeMappingParserHelper.h:50