21#ifndef MAPPING_CONFIGURATION_TO_XML_FACTORY_H_INCLUDED
22#define MAPPING_CONFIGURATION_TO_XML_FACTORY_H_INCLUDED
43template <
typename DomNodeType>
61 DomNodeType sub_node = parent_node.createChild(
"header");
77 DomNodeType property_node = parent_node.createChild(
"property");
78 property_node.setAttribute(
"name", property_value.
getName());
79 property_node.setData(property_value.
getValue());
88 template <
typename PropertiesType>
89 static void createProperties(DomNodeType& parent_node,
const PropertiesType& properties)
91 DomNodeType properties_node = parent_node.createChild(
"properties");
92 for (
const auto& current_property: properties) {
93 DomNodeType property_node = properties_node.createChild(
"property");
94 property_node.setAttribute(
"name", current_property.second->getName());
95 property_node.setData(current_property.second->getValue());
106 DomNodeType source_node = parent_node.createChild(
"source");
107 source_node.setAttribute(
"name", source.
getName());
108 xml_base_type::template setOptionalAttribute(source_node,
"source_type", source.
getType());
120 DomNodeType param_value_node = parent_node.createChild(
"parameter_value");
121 param_value_node.setAttribute(
"name", parameter_value.
getName());
123 param_value_node.setAttribute(
"type",
"const");
128 param_value_node.setAttribute(
"type",
"source");
132 param_value_node,
"value_name", source_value.value_name);
135 param_value_node.setAttribute(
"type",
"internal");
138 param_value_node,
"internal_name", internal_value.name);
140 param_value_node,
"value_name", internal_value.value_name);
151 DomNodeType assignment_node = parent_node.createChild(
"assignment");
154 assignment_node.setAttribute(
"type",
"const");
159 assignment_node.setAttribute(
"type",
"source");
163 assignment_node,
"value_name", source_value.value_name);
166 assignment_node.setAttribute(
"type",
"call");
170 createNode(assignment_node, *current_param_value);
175 "createNode", {
"assignment", assignment.
getName()},
"invalid assignment type");
186 DomNodeType trigger_node = parent_node.createChild(
"trigger");
189 trigger_node.setAttribute(
"type",
"source");
194 trigger_node.setAttribute(
"type",
"periodic");
200 trigger_node.setAttribute(
"type",
"data");
201 const auto data = trigger.
getData();
208 throw Error(
"createNode", {
"trigger"},
"invalid trigger type");
211 if (!time_strategy.empty()) {
223 DomNodeType target_node = parent_node.createChild(
"target");
224 target_node.setAttribute(
"name", target.
getName());
225 xml_base_type::template setOptionalAttribute(target_node,
"target_type", target.
getType());
231 DomNodeType assignments_node = target_node.createChild(
"assignments");
233 createNode(assignments_node, *(current_assignment));
237 DomNodeType triggers_node = target_node.createChild(
"triggers");
238 for (
const auto& current_trigger: target.
getTriggers()) {
239 createNode(triggers_node, *(current_trigger));
250 DomNodeType function_node = parent_node.createChild(
"function");
251 function_node.setAttribute(
"name", function_inst.
getName());
252 xml_base_type::template setOptionalAttribute(
253 function_node,
"function_type", function_inst.
getType());
270 DomNodeType sources_node = parent_node.createChild(
"sources");
273 for (
const auto& source: sources) {
277 DomNodeType targets_node = parent_node.createChild(
"targets");
280 for (
const auto& target: targets) {
284 DomNodeType functions_node = parent_node.createChild(
"functions");
287 for (
const auto& func_inst: functions) {
288 createNode(functions_node, *(func_inst.second));
static std::string toString(const Version &version)
Version to string conversion.
Mapping Version.
Definition mapping_version.h:32
Datamodel assignment class used in Target.
Definition datamodel_configuration_items.h:912
const std::string & getName() const
Get the name of the assignment value to assign to (the same as getTo)
@ const_value
The assignment is a const value assignment.
Definition datamodel_configuration_items.h:927
@ source_value
The assignment is a source value assignment.
Definition datamodel_configuration_items.h:922
@ function_call
The assignment is a function call assignment.
Definition datamodel_configuration_items.h:932
ConstValue getConstValue() const
Get the const value if type is set to Type::const_value.
SourceValue getSourceValue() const
Get the source value if type is set to Type::source_value.
FunctionCall getFunctionCall() const
Get the function call value if type is set to Type::function_call.
const ParameterValues & getParameterValues() const
Get the ParameterValues.
const std::string & getTo() const
Get the assignment value to assign to.
Type getType() const
Get the type.
Datamodel function class used in MappingConfiguration.
Definition datamodel_configuration_items.h:1314
const std::string & getType() const
Get the type.
const Properties & getProperties() const
Get the Properties.
const std::string & getName() const
Get the name.
The mapping configuration datamodel.
Definition datamodel_configuration.h:38
std::shared_ptr< const Header > getHeader() const
Get the Header object.
const Functions & getFunctions() const
Get the Functions.
Version getVersion() const
Get the Version.
const Targets & getTargets() const
Get the Targets.
const Sources & getSources() const
Get the Sources.
Datamodel parameter value class used within Assignment.
Definition datamodel_configuration_items.h:654
Type getType() const
Get the type.
const std::string & getName() const
Get the name.
InternalValue getInternalValue() const
Get the internal value if type is set to Type::internal_value.
ConstValue getConstValue() const
Get the const value if type is set to Type::const_value.
@ const_value
The parameter value is a const value.
Definition datamodel_configuration_items.h:669
@ source_value
The parameter value is a source value.
Definition datamodel_configuration_items.h:664
@ internal_value
The parameter value is a const value.
Definition datamodel_configuration_items.h:674
SourceValue getSourceValue() const
Get the source value if type is set to Type::source_value.
Datamodel property class used in Source, Target, Function.
Definition datamodel_configuration_items.h:173
const std::string & getName() const
Get the name.
const std::string & getValue() const
Get the value.
Datamodel source class used in MappingConfiguration.
Definition datamodel_configuration_items.h:262
const std::string & getType() const
Get the type.
const Properties & getProperties() const
Get the Properties.
const std::string & getName() const
Get the name.
Datamodel target class within MappingConfiguration.
Definition datamodel_configuration_items.h:1155
const std::string & getName() const
Get the name.
const Assignments & getAssignments() const
Get the Assignments.
const Triggers & getTriggers() const
Get the Triggers.
const Properties & getProperties() const
Get the Properties.
const std::string & getType() const
Get the type of the target instance to create.
Datamodel trigger class use within Target.
Definition datamodel_configuration_items.h:376
Period getPeriod() const
Get the period value if type is set to Type::period.
Type getType() const
Get the type.
@ source
The trigger is a source trigger.
Definition datamodel_configuration_items.h:386
@ data
The trigger is a data trigger.
Definition datamodel_configuration_items.h:391
@ period
The trigger is a periodic trigger.
Definition datamodel_configuration_items.h:396
Source getSource() const
Get the source value if type is set to Type::source.
Data getData() const
Get the data value if type is set to Type::data.
const std::string & getTimeStrategy() const
definition of the mapping namespace
Definition ddl.h:50
ddl::utility::Error Error
mapping error definition
Definition mapping_configuration_types.h:35
definition of the ddl namespace
Definition codec.h:21
Template class to create MappingConfiguration DOM nodes with the help of the type DomNodeType.
Definition datamodel_xml_configurationtoxml_10.h:158
static void createNode(DomNodeType &parent_node, const datamodel::Source &source)
Create a Node for a source.
Definition datamodel_xml_configurationtoxml_10.h:169
Template class to create MappingConfiguration DOM nodes with the help of the type DomNodeType.
Definition datamodel_xml_configurationtoxml_base.h:43
static void setOptionalSubNodeData(DomNodeType &dom_node, const std::string &sub_node_name, const std::string &value)
Set the data of the new created tag with the name sub_node_name.
Definition datamodel_xml_configurationtoxml_base.h:107
static void setSubNodeData(DomNodeType &dom_node, const std::string &sub_node_name, const std::string &value)
Set the data of the new created tag with the name sub_node_name.
Definition datamodel_xml_configurationtoxml_base.h:93
Template class to create MappingConfiguration DOM nodes with the help of the type DomNodeType.
Definition datamodel_xml_configurationtoxml.h:44
static void createNode(DomNodeType &parent_node, const datamodel::Source &source)
Create a Node for a source.
Definition datamodel_xml_configurationtoxml.h:104
MappingConfigurationToXMLFactoryBase< DomNodeType > xml_base_type
base factory type for xml writing
Definition datamodel_xml_configurationtoxml.h:48
static void createNode(DomNodeType &parent_node, const datamodel::Target &target)
Create a Node for a Target.
Definition datamodel_xml_configurationtoxml.h:221
static void createNode(DomNodeType &parent_node, const datamodel::MappingConfiguration &config)
Create a Node for the MappingConfiguration.
Definition datamodel_xml_configurationtoxml.h:262
static void createNode(DomNodeType &parent_node, const datamodel::Header &header)
Create a Node for the header.
Definition datamodel_xml_configurationtoxml.h:59
MappingConfigurationToXMLFactory10< DomNodeType > xml_mapping10_type
mapping10 xml writing factory type for compatibility of mapping 1.0 definition
Definition datamodel_xml_configurationtoxml.h:52
static void createNode(DomNodeType &parent_node, const datamodel::Function &function_inst)
Create a Node for a Funtion.
Definition datamodel_xml_configurationtoxml.h:248
static void createNode(DomNodeType &parent_node, const datamodel::ParameterValue ¶meter_value)
Create a Node for a ParameterValue.
Definition datamodel_xml_configurationtoxml.h:117
static void createNode(DomNodeType &parent_node, const datamodel::Property &property_value)
Create a Node for a property.
Definition datamodel_xml_configurationtoxml.h:75
static void createNode(DomNodeType &parent_node, const datamodel::Assignment &assignment)
Create a Node for an Assignment.
Definition datamodel_xml_configurationtoxml.h:149
static void createNode(DomNodeType &parent_node, const datamodel::Trigger &trigger)
Create a Node for a Trigger.
Definition datamodel_xml_configurationtoxml.h:184
static void createProperties(DomNodeType &parent_node, const PropertiesType &properties)
Create a the properties nodes.
Definition datamodel_xml_configurationtoxml.h:89
std::string value
the const value
Definition datamodel_configuration_items.h:700
std::string source_name
the source name to trigger on update
Definition datamodel_configuration_items.h:407