ADTF  3.18.2
map_configuration.h
Go to the documentation of this file.
1 
14 #ifndef HEADER_MAP_CONFIGURATION_H
15 #define HEADER_MAP_CONFIGURATION_H
16 
17 #include <ddl/dd/dd.h>
24 
25 #include <vector>
26 
27 namespace ddl {
28 namespace mapping {
29 
30 typedef std::vector<std::string> MapErrorList;
37 public: // 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 
59 private:
65  const std::shared_ptr<const ddl::dd::datamodel::DataDefinition>& ddl_datamodel);
66 
67 public:
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 
333  const MapSourceList& getSourceList() const;
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 
398  const MapTargetList& getTargetList() const;
399 
406  const MapErrorList& getErrorList() const;
407 
414 
418  void appendError(const std::string& error_string) const;
419 
426 
431  bool isConsistent();
432 
441 
442 private:
446  void swap(MapConfiguration& other);
447 
453 
463  MapConfiguration& tmp_config);
464 
472 
480 
488 
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 
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 
550 
551 private:
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
A common result class usable as return value throughout.
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
Definition: dd.h:87
Class to access and obtain the byte position and other information of a instance of this element with...
observable DataDefinition object class to describe StructType.
MapConfiguration is the central class of the mapping::dd namespace.
a_util::result::Result checkAssignmentReferences(const MapAssignment &assignment) const
Checks the configuration for consistency of a new assignment.
a_util::result::Result loadFromFile(const std::string &file_path, uint32_t flags=mc_load_mapping)
Import mapping configuration from a file Load file in DOM and call loadFromDOM()
const MapTransformationBase * getTransformation(const std::string &transformation_name) const
Returns a specific transformation from the configuration.
a_util::result::Result addTarget(const std::string &name, const std::string &type)
Add a target signal to use in mapping.
a_util::result::Result addTarget(const MapTarget &target)
Add a target signal to configuration.
a_util::result::Result checkSignalName(const std::string &name) const
Checks the configuration for consistency of a new signal.
a_util::result::Result resetErrors()
Clear error list and verify DataDefinition Description exists.
MapConfiguration & operator=(MapConfiguration &&other)
Assignment operator.
a_util::result::Result setDD(const ddl::dd::DataDefinition &dd)
Set the reference DD.
MapTarget * getTarget(const std::string &target_name)
Returns a specific mapping target from the configuration.
a_util::result::Result setHeaderDescription(const std::string &desc)
Set the description in configuration header.
void repairConfigReferences(MapConfiguration &config)
Set reference to new configuration.
a_util::result::Result checkSignalType(const std::string &type) const
Checks the configuration for consistency of a new signal.
const ddl::dd::StructElementAccess findTypeObject(const std::string &struct_name, const std::string &path) const
Find a DataDefinition data type within a struct given a path to the element.
a_util::result::Result loadPartiallyFromDOM(a_util::xml::DOM &dom, uint32_t flags=mc_load_mapping)
Import mapping configuration from a XML dom instance Modell is laoding even if it is not consistent w...
std::shared_ptr< const ddl::dd::datamodel::DataDefinition > getDD() const
Get the reference ddl description.
a_util::result::Result merge(const MapConfiguration &other)
merge another configuration into this one
a_util::result::Result checkAssignmentType(const std::string &signal_name, const ddl::dd::datamodel::StructType &signal_struct, const MapAssignment &assignment) const
Checks the configuration for consistency of a new assignment.
a_util::result::Result writeToFile(const std::string &file_path)
Export mapping configuration to a file Call writeToDOM() and wirte DOM to file.
MapConfiguration(const std::shared_ptr< const ddl::dd::datamodel::DataDefinition > &ddl_datamodel)
CTOR.
a_util::result::Result removeTarget(const std::string &name)
Remove a target signal from the configuration All connections using this source will be deleted.
a_util::result::Result loadPartiallyFromFile(const std::string &file_path, uint32_t flags=mc_load_mapping)
Import mapping configuration from a file Load file in DOM and call loadPartiallyFromDOM() Modell is l...
a_util::result::Result removeSource(const std::string &name)
Remove a source signal from the configuration All connections using this source will be deleted.
const MapTarget * getTarget(const std::string &target_name) const
Returns a specific mapping target from the configuration.
a_util::result::Result modifyDD(const ddl::dd::DataDefinition &ddl)
Modify the reference ddl description Set the new ddl description and check mapping consistency.
a_util::result::Result addSource(const std::string &name, const std::string &type)
Add a source signal to use in mapping.
const MapTransformationList & getTransformationList() const
Returns all transformations contained in the configuration.
a_util::result::Result checkMappingConsistency()
Checks the mapping for consistency All referenced Sources and Transformations must exist in Mapping.
a_util::result::Result removeTransformation(const std::string &transformation_name)
Remove a transformation.
MapConfiguration(const ddl::dd::DataDefinition &ddl)
CTOR.
MapTransformationBase * getTransformation(const std::string &transformation_name)
Returns a specific transformation from the configuration.
const std::string & getHeaderDDPaths() const
Get the ddl paths attribute from configuration header.
a_util::result::Result checkTriggerType(const MapTriggerBase *trigger) const
Checks the configuration for consistency of a new trigger.
const MapErrorList & getErrorList() const
Returns the error list, containing human readable error messages.
MapConfiguration(MapConfiguration &&other)
C-CTOR.
a_util::result::Result loadFromDOM(a_util::xml::DOM &dom, uint32_t flags=mc_load_mapping)
Import mapping configuration from a XML dom instance.
void swap(MapConfiguration &other)
swap implementation for use in the assignment op
const MapSourceList & getSourceList() const
Returns all mapping sources contained in the configuration.
a_util::result::Result loadFromDOMWithoutDDLConsistency(a_util::xml::DOM &dom, uint32_t flags=mc_load_mapping)
Import mapping configuration from a XML dom instance without checking for DataDefinition consistency.
a_util::result::Result setDDWithoutConsistency(const ddl::dd::DataDefinition &ddl)
Set the reference Data description without consistency check.
bool isConsistencyChecked()
Returns bool flag indicating whether consistency of mapping with its DataDefinition was already check...
a_util::result::Result setHeaderDDPaths(const std::string &ddl_path)
Set the ddl paths attribute in configuration header.
const MapSource * getSource(const std::string &source_name) const
Returns a specific mapping source from the configuration.
MapSource * getSource(const std::string &source_name)
Returns a specific mapping source from the configuration.
a_util::result::Result checkDDLConsistency()
Checks the configuration for consistency with ddl representation (all types, transformations etc.
bool isConsistent()
Returns bool flag indicating consistency of mapping with its DataDefinition.
MapConfiguration(const MapConfiguration &other)
C-CTOR.
static a_util::result::Result loadMappingFromDOM(a_util::xml::DOM &dom, MapConfiguration &tmp_config)
Import mapping configuration from a XML dom instance.
void reset()
Resets the entire map configuration to its initial, empty state.
MapConfigFlags
Mapping import flags (loadFromFile, loadFromDOM)
void appendError(const std::string &error_string) const
Append error to error list.
a_util::result::Result addTransformation(const std::string &transformation_name, const std::string &transformation_type)
Add a transformation to use in mapping.
const MapTargetList & getTargetList() const
Returns all mapping targets contained in the configuration.
a_util::result::Result writeToDOM(a_util::xml::DOM &dom)
Export mapping configuration to a XML dom instance.
a_util::result::Result resetDD()
Resets the reference DD.
a_util::result::Result addSource(const MapSource &source)
Add a source signal to configuration.
const MapHeader & getHeader() const
Returns the mapping header of the configuration.
MapConfiguration & operator=(const MapConfiguration &other)
Assignment operator.
implementation of a data trigger in the configuration api
Definition: map_trigger.h:240
MapHeader contains all information from the header-Tag of a mapping configuration.
Definition: map_header.h:31
MapSource represents a mapping source from the configuration file.
Definition: map_source.h:31
MapTarget represents a mapped target from the mapping configuration.
Definition: map_target.h:31
cMapTransformation forms a base class for a single transformation
cMapTrigger forms a base class for a trigger contained in the configuration
Definition: map_trigger.h:29
OO DataDefinition - Data Definition.
WRITER_TYPE & trigger(WRITER_TYPE &oWriter)
Global function template to trigger a writers sample stream manually.
std::vector< std::string > MapErrorList
container type for mapping errors
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.
std::vector< MapTarget > MapTargetList
Public composite types used in the mapping::dd namespace.
Definition: map_target.h:251