ADTF  3.14.3
map_configuration.h
Go to the documentation of this file.
1 
20 #ifndef HEADER_MAP_CONFIGURATION_H
21 #define HEADER_MAP_CONFIGURATION_H
22 
23 #include <ddl/dd/dd.h>
30 
31 #include <vector>
32 
33 namespace ddl {
34 namespace mapping {
35 
36 typedef std::vector<std::string> MapErrorList;
43 public: // methods
46  // replace the existing configuration
47  mc_load_mapping = 0x1 << 0,
48 
49  // merge any new configuration into the current one
50  // (error on conflicting configuration)
51  mc_merge_mapping = 0x1 << 1
52  };
53 
58 
64 
65 private:
71  const std::shared_ptr<const ddl::dd::datamodel::DataDefinition>& ddl_datamodel);
72 
73 public:
78 
83 
88 
93 
98 
107 
115 
123 
134 
138  std::shared_ptr<const ddl::dd::datamodel::DataDefinition> getDD() const;
139 
145  void reset();
146 
158  a_util::result::Result loadFromFile(const std::string& file_path,
159  uint32_t flags = mc_load_mapping);
160 
175  a_util::result::Result loadFromDOM(a_util::xml::DOM& dom, uint32_t flags = mc_load_mapping);
176 
190  uint32_t flags = mc_load_mapping);
191 
205  a_util::result::Result loadPartiallyFromFile(const std::string& file_path,
206  uint32_t flags = mc_load_mapping);
207 
224  uint32_t flags = mc_load_mapping);
225 
235  a_util::result::Result writeToFile(const std::string& file_path);
236 
249 
253  const MapHeader& getHeader() const;
254 
260 
265  a_util::result::Result setHeaderDDPaths(const std::string& ddl_path);
266 
270  const std::string& getHeaderDDPaths() const;
271 
276 
285  const MapTransformationBase* getTransformation(const std::string& transformation_name) const;
286 
295  MapTransformationBase* getTransformation(const std::string& transformation_name);
296 
306  a_util::result::Result addTransformation(const std::string& transformation_name,
307  const std::string& transformation_type);
308 
315  a_util::result::Result removeTransformation(const std::string& transformation_name);
316 
325  const MapSource* getSource(const std::string& source_name) const;
326 
335  MapSource* getSource(const std::string& source_name);
336 
340  const MapSourceList& getSourceList() const;
341 
351  a_util::result::Result addSource(const std::string& name, const std::string& type);
352 
360  a_util::result::Result removeSource(const std::string& name);
361 
370  const MapTarget* getTarget(const std::string& target_name) const;
371 
380  MapTarget* getTarget(const std::string& target_name);
381 
391  a_util::result::Result addTarget(const std::string& name, const std::string& type);
392 
400  a_util::result::Result removeTarget(const std::string& name);
401 
405  const MapTargetList& getTargetList() const;
406 
413  const MapErrorList& getErrorList() const;
414 
421 
425  void appendError(const std::string& error_string) const;
426 
433 
438  bool isConsistent();
439 
448 
449 private:
453  void swap(MapConfiguration& other);
454 
460 
470  MapConfiguration& tmp_config);
471 
479 
487 
495 
503 
515  const ddl::dd::StructElementAccess findTypeObject(const std::string& struct_name,
516  const std::string& path) const;
517 
524  a_util::result::Result checkSignalName(const std::string& name) const;
525 
532  a_util::result::Result checkSignalType(const std::string& type) const;
533 
541 
550  a_util::result::Result checkAssignmentType(const std::string& signal_name,
551  const ddl::dd::datamodel::StructType& signal_struct,
552  const MapAssignment& assignment) const;
553 
561 
562 private:
564  friend class MapSource;
565  friend class MapTarget;
566  friend class MapTriggerBase;
567  friend class MapDataTrigger;
568  MapHeader _header;
569  MapSourceList _sources;
570  MapTargetList _targets;
571  MapTransformationList _transforms;
572  // mutable because its not part of the object state
573  mutable MapErrorList _errors;
574  std::shared_ptr<const ddl::dd::datamodel::DataDefinition> _ddl_ref;
575  bool _checked_for_consistency;
576  bool _is_consistent;
578 };
579 
580 } // namespace mapping
581 } // namespace ddl
582 
583 #endif // HEADER_MAP_CONFIGURATION_H
A common result class usable as return value throughout.
XML parser to read and write standard XML files.
Definition: dom.h:277
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
Definition: dd.h:93
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:248
MapHeader contains all information from the header-Tag of a mapping configuration.
Definition: map_header.h:37
MapSource represents a mapping source from the configuration file.
Definition: map_source.h:37
MapTarget represents a mapped target from the mapping configuration.
Definition: map_target.h:37
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:35
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:141
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:262
definition of the ddl namespace

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)