ADTF
Loading...
Searching...
No Matches
map_configuration.h
Go to the documentation of this file.
1
13
14#ifndef HEADER_MAP_CONFIGURATION_H
15#define HEADER_MAP_CONFIGURATION_H
16
17#include <ddl/dd/dd.h>
24
25#include <vector>
26
27namespace ddl {
28namespace mapping {
29
30typedef std::vector<std::string> MapErrorList;
37public: // methods
40 // replace the existing configuration
41 mc_load_mapping = 0x1 << 0,
42
43 // merge any new configuration into the current one
44 // (error on conflicting configuration)
45 mc_merge_mapping = 0x1 << 1
46 };
47
52
58
59private:
65 const std::shared_ptr<const ddl::dd::datamodel::DataDefinition>& ddl_datamodel);
66
67public:
72
77
82
87
92
101
109
117
128
132 std::shared_ptr<const ddl::dd::datamodel::DataDefinition> getDD() const;
133
138 void reset();
139
151 a_util::result::Result loadFromFile(const std::string& file_path,
152 uint32_t flags = mc_load_mapping);
153
168 a_util::result::Result loadFromDOM(a_util::xml::DOM& dom, uint32_t flags = mc_load_mapping);
169
183 uint32_t flags = mc_load_mapping);
184
198 a_util::result::Result loadPartiallyFromFile(const std::string& file_path,
199 uint32_t flags = mc_load_mapping);
200
217 uint32_t flags = mc_load_mapping);
218
228 a_util::result::Result writeToFile(const std::string& file_path);
229
242
246 const MapHeader& getHeader() const;
247
253
258 a_util::result::Result setHeaderDDPaths(const std::string& ddl_path);
259
263 const std::string& getHeaderDDPaths() const;
264
269
278 const MapTransformationBase* getTransformation(const std::string& transformation_name) const;
279
288 MapTransformationBase* getTransformation(const std::string& transformation_name);
289
299 a_util::result::Result addTransformation(const std::string& transformation_name,
300 const std::string& transformation_type);
301
308 a_util::result::Result removeTransformation(const std::string& transformation_name);
309
318 const MapSource* getSource(const std::string& source_name) const;
319
328 MapSource* getSource(const std::string& source_name);
329
334
344 a_util::result::Result addSource(const std::string& name, const std::string& type);
345
353 a_util::result::Result removeSource(const std::string& name);
354
363 const MapTarget* getTarget(const std::string& target_name) const;
364
373 MapTarget* getTarget(const std::string& target_name);
374
384 a_util::result::Result addTarget(const std::string& name, const std::string& type);
385
393 a_util::result::Result removeTarget(const std::string& name);
394
399
407
414
418 void appendError(const std::string& error_string) const;
419
426
432
441
442private:
446 void swap(MapConfiguration& other);
447
452 void repairConfigReferences(MapConfiguration& config);
453
462 static a_util::result::Result loadMappingFromDOM(a_util::xml::DOM& dom,
463 MapConfiguration& tmp_config);
464
472
480
487 a_util::result::Result checkMappingConsistency();
488
495 a_util::result::Result merge(const MapConfiguration& other);
496
504 const ddl::dd::StructElementAccess findTypeObject(const std::string& struct_name,
505 const std::string& path) const;
506
513 a_util::result::Result checkSignalName(const std::string& name) const;
514
521 a_util::result::Result checkSignalType(const std::string& type) const;
522
529 a_util::result::Result checkAssignmentReferences(const MapAssignment& assignment) const;
530
539 a_util::result::Result checkAssignmentType(const std::string& signal_name,
540 const ddl::dd::datamodel::StructType& signal_struct,
541 const MapAssignment& assignment) const;
542
549 a_util::result::Result checkTriggerType(const MapTriggerBase* trigger) const;
550
551private:
553 friend class MapSource;
554 friend class MapTarget;
555 friend class MapTriggerBase;
556 friend class MapDataTrigger;
557 MapHeader _header;
558 MapSourceList _sources;
559 MapTargetList _targets;
560 MapTransformationList _transforms;
561 // mutable because its not part of the object state
562 mutable MapErrorList _errors;
563 std::shared_ptr<const ddl::dd::datamodel::DataDefinition> _ddl_ref;
564 bool _checked_for_consistency;
565 bool _is_consistent;
567};
568
569} // namespace mapping
570} // namespace ddl
571
572#endif // HEADER_MAP_CONFIGURATION_H
Definition result_type_decl.h:34
XML parser to read and write standard XML files.
Definition dom.h:318
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
Definition dd.h:92
Class to access and obtain the byte position and other information of a instance of this element with...
Definition dd_struct_access.h:41
observable DataDefinition object class to describe StructType.
Definition datamodel_types.h:453
Definition map_assignment.h:33
a_util::result::Result addTarget(const std::string &name, const std::string &type)
a_util::result::Result loadPartiallyFromDOM(a_util::xml::DOM &dom, uint32_t flags=mc_load_mapping)
a_util::result::Result loadPartiallyFromFile(const std::string &file_path, uint32_t flags=mc_load_mapping)
const MapTarget * getTarget(const std::string &target_name) const
a_util::result::Result removeSource(const std::string &name)
MapConfiguration & operator=(MapConfiguration &&other)
a_util::result::Result removeTarget(const std::string &name)
const MapSource * getSource(const std::string &source_name) const
MapConfiguration(const MapConfiguration &other)
const MapTransformationList & getTransformationList() const
a_util::result::Result setHeaderDDPaths(const std::string &ddl_path)
const MapHeader & getHeader() const
a_util::result::Result removeTransformation(const std::string &transformation_name)
MapTarget * getTarget(const std::string &target_name)
a_util::result::Result resetErrors()
MapSource * getSource(const std::string &source_name)
a_util::result::Result addTransformation(const std::string &transformation_name, const std::string &transformation_type)
const MapSourceList & getSourceList() const
a_util::result::Result loadFromDOMWithoutDDLConsistency(a_util::xml::DOM &dom, uint32_t flags=mc_load_mapping)
a_util::result::Result modifyDD(const ddl::dd::DataDefinition &ddl)
a_util::result::Result checkDDLConsistency()
void appendError(const std::string &error_string) const
MapConfiguration(const ddl::dd::DataDefinition &ddl)
a_util::result::Result setHeaderDescription(const std::string &desc)
MapConfiguration & operator=(const MapConfiguration &other)
a_util::result::Result resetDD()
a_util::result::Result loadFromDOM(a_util::xml::DOM &dom, uint32_t flags=mc_load_mapping)
a_util::result::Result writeToFile(const std::string &file_path)
a_util::result::Result loadFromFile(const std::string &file_path, uint32_t flags=mc_load_mapping)
const std::string & getHeaderDDPaths() const
MapTransformationBase * getTransformation(const std::string &transformation_name)
const MapErrorList & getErrorList() const
const MapTransformationBase * getTransformation(const std::string &transformation_name) const
MapConfigFlags
Mapping import flags (loadFromFile, loadFromDOM)
Definition map_configuration.h:39
std::shared_ptr< const ddl::dd::datamodel::DataDefinition > getDD() const
const MapTargetList & getTargetList() const
a_util::result::Result addSource(const std::string &name, const std::string &type)
a_util::result::Result setDD(const ddl::dd::DataDefinition &dd)
a_util::result::Result writeToDOM(a_util::xml::DOM &dom)
MapConfiguration(MapConfiguration &&other)
a_util::result::Result setDDWithoutConsistency(const ddl::dd::DataDefinition &ddl)
implementation of a data trigger in the configuration api
Definition map_trigger.h:240
Definition map_header.h:31
Definition map_source.h:31
Definition map_target.h:31
Definition map_transformation.h:30
Definition map_trigger.h:29
definition of the dd namespace
Definition datamodel_base.h:26
definition of the mapping namespace
Definition ddl.h:50
std::vector< std::string > MapErrorList
container type for mapping errors
Definition map_assignment.h:29
std::vector< MapTarget > MapTargetList
Public composite types used in the mapping::dd namespace.
Definition map_target.h:251
std::vector< MapSource > MapSourceList
Public composite types used in the mapping::dd namespace.
Definition map_source.h:134
std::vector< MapTransformationBase * > MapTransformationList
Public composite types used in the mapping::dd namespace.
Definition map_transformation.h:361
definition of the ddl namespace
Definition codec.h:21