ADTF  3.14.3
MapConfiguration

MapConfiguration is the central class of the mapping::dd namespace. More...

Public Types

enum  MapConfigFlags { mc_load_mapping = 0x1 << 0 , mc_merge_mapping = 0x1 << 1 }
 Mapping import flags (loadFromFile, loadFromDOM)
 

Public Member Functions

 MapConfiguration ()
 CTOR.
 
 MapConfiguration (const ddl::dd::DataDefinition &ddl)
 CTOR. More...
 
 ~MapConfiguration ()
 DTOR.
 
 MapConfiguration (const MapConfiguration &other)
 C-CTOR.
 
MapConfigurationoperator= (const MapConfiguration &other)
 Assignment operator.
 
 MapConfiguration (MapConfiguration &&other)
 C-CTOR.
 
MapConfigurationoperator= (MapConfiguration &&other)
 Assignment operator.
 
a_util::result::Result setDD (const ddl::dd::DataDefinition &dd)
 Set the reference DD. More...
 
a_util::result::Result resetDD ()
 Resets the reference DD. More...
 
a_util::result::Result setDDWithoutConsistency (const ddl::dd::DataDefinition &ddl)
 Set the reference Data description without consistency check. More...
 
a_util::result::Result modifyDD (const ddl::dd::DataDefinition &ddl)
 Modify the reference ddl description Set the new ddl description and check mapping consistency. More...
 
std::shared_ptr< const ddl::dd::datamodel::DataDefinitiongetDD () const
 Get the reference ddl description.
 
void reset ()
 Resets the entire map configuration to its initial, empty state. More...
 
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() More...
 
a_util::result::Result loadFromDOM (a_util::xml::DOM &dom, uint32_t flags=mc_load_mapping)
 Import mapping configuration from a XML dom instance. More...
 
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. More...
 
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 loaded even if it is not consistent with the DataDefinition description Each element has a validity flag representing its consistency. More...
 
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 with the DataDefinition description Each element has a validity flag representing its consistency. More...
 
a_util::result::Result writeToFile (const std::string &file_path)
 Export mapping configuration to a file Call writeToDOM() and wirte DOM to file. More...
 
a_util::result::Result writeToDOM (a_util::xml::DOM &dom)
 Export mapping configuration to a XML dom instance. More...
 
const MapHeadergetHeader () const
 Returns the mapping header of the configuration.
 
a_util::result::Result setHeaderDescription (const std::string &desc)
 Set the description in configuration header. More...
 
a_util::result::Result setHeaderDDPaths (const std::string &ddl_path)
 Set the ddl paths attribute in configuration header. More...
 
const std::string & getHeaderDDPaths () const
 Get the ddl paths attribute from configuration header.
 
const MapTransformationListgetTransformationList () const
 Returns all transformations contained in the configuration.
 
const MapTransformationBasegetTransformation (const std::string &transformation_name) const
 Returns a specific transformation from the configuration. More...
 
MapTransformationBasegetTransformation (const std::string &transformation_name)
 Returns a specific transformation from the configuration. More...
 
a_util::result::Result addTransformation (const std::string &transformation_name, const std::string &transformation_type)
 Add a transformation to use in mapping. More...
 
a_util::result::Result removeTransformation (const std::string &transformation_name)
 Remove a transformation. More...
 
const MapSourcegetSource (const std::string &source_name) const
 Returns a specific mapping source from the configuration. More...
 
MapSourcegetSource (const std::string &source_name)
 Returns a specific mapping source from the configuration. More...
 
const MapSourceListgetSourceList () const
 Returns all mapping sources contained in the configuration.
 
a_util::result::Result addSource (const std::string &name, const std::string &type)
 Add a source signal to use in mapping. More...
 
a_util::result::Result removeSource (const std::string &name)
 Remove a source signal from the configuration All connections using this source will be deleted. More...
 
const MapTargetgetTarget (const std::string &target_name) const
 Returns a specific mapping target from the configuration. More...
 
MapTargetgetTarget (const std::string &target_name)
 Returns a specific mapping target from the configuration. More...
 
a_util::result::Result addTarget (const std::string &name, const std::string &type)
 Add a target signal to use in mapping. More...
 
a_util::result::Result removeTarget (const std::string &name)
 Remove a target signal from the configuration All connections using this source will be deleted. More...
 
const MapTargetListgetTargetList () const
 Returns all mapping targets contained in the configuration.
 
const MapErrorListgetErrorList () const
 Returns the error list, containing human readable error messages. More...
 
a_util::result::Result resetErrors ()
 Clear error list and verify DataDefinition Description exists. More...
 
void appendError (const std::string &error_string) const
 Append error to error list.
 
bool isConsistencyChecked ()
 Returns bool flag indicating whether consistency of mapping with its DataDefinition was already checked. More...
 
bool isConsistent ()
 Returns bool flag indicating consistency of mapping with its DataDefinition. More...
 
a_util::result::Result checkDDLConsistency ()
 Checks the configuration for consistency with ddl representation (all types, transformations etc. More...
 

Private Member Functions

 MapConfiguration (const std::shared_ptr< const ddl::dd::datamodel::DataDefinition > &ddl_datamodel)
 CTOR. More...
 
void swap (MapConfiguration &other)
 swap implementation for use in the assignment op
 
void repairConfigReferences (MapConfiguration &config)
 Set reference to new configuration. More...
 
a_util::result::Result addTarget (const MapTarget &target)
 Add a target signal to configuration. More...
 
a_util::result::Result addSource (const MapSource &source)
 Add a source signal to configuration. More...
 
a_util::result::Result checkMappingConsistency ()
 Checks the mapping for consistency All referenced Sources and Transformations must exist in Mapping. More...
 
a_util::result::Result merge (const MapConfiguration &other)
 merge another configuration into this one More...
 
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 More...
 
a_util::result::Result checkSignalName (const std::string &name) const
 Checks the configuration for consistency of a new signal. More...
 
a_util::result::Result checkSignalType (const std::string &type) const
 Checks the configuration for consistency of a new signal. More...
 
a_util::result::Result checkAssignmentReferences (const MapAssignment &assignment) const
 Checks the configuration for consistency of a new assignment. More...
 
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. More...
 
a_util::result::Result checkTriggerType (const MapTriggerBase *trigger) const
 Checks the configuration for consistency of a new trigger. More...
 

Static Private Member Functions

static a_util::result::Result loadMappingFromDOM (a_util::xml::DOM &dom, MapConfiguration &tmp_config)
 Import mapping configuration from a XML dom instance. More...
 

Detailed Description

MapConfiguration is the central class of the mapping::dd namespace.

It represents a whole mapping configuration which can be imported from a mapping configuration file.

Definition at line 42 of file map_configuration.h.

Constructor & Destructor Documentation

◆ MapConfiguration() [1/2]

CTOR.

Parameters
[in]ddlThe DataDefinition information base used for type lookup

◆ MapConfiguration() [2/2]

MapConfiguration ( const std::shared_ptr< const ddl::dd::datamodel::DataDefinition > &  ddl_datamodel)
private

CTOR.

Parameters
[in]ddlThe DataDefinition information base used for type lookup

Member Function Documentation

◆ addSource() [1/2]

a_util::result::Result addSource ( const MapSource source)
private

Add a source signal to configuration.

Parameters
[in]sourceThe source signal
Return values
ERR_INVALID_ARGSignal name already used in configuration
a_util::result::SUCCESSEverything went fine

◆ addSource() [2/2]

a_util::result::Result addSource ( const std::string &  name,
const std::string &  type 
)

Add a source signal to use in mapping.

Parameters
[in]nameThe name of the source
[in]typeThe type of the source
Return values
ERR_INVALID_STATENo description found
ERR_INVALID_TYPEInconsistency with ddl
ERR_INVALID_ARGSignal name already used in configuration
a_util::result::SUCCESSEverything went fine

◆ addTarget() [1/2]

a_util::result::Result addTarget ( const MapTarget target)
private

Add a target signal to configuration.

Parameters
[in]targetThe target signal
Return values
ERR_INVALID_ARGSignal name already used in configuration
a_util::result::SUCCESSEverything went fine

◆ addTarget() [2/2]

a_util::result::Result addTarget ( const std::string &  name,
const std::string &  type 
)

Add a target signal to use in mapping.

Parameters
[in]nameThe name of the target
[in]typeThe type of the target
Return values
ERR_INVALID_STATENo description found
ERR_INVALID_TYPEInconsistency with ddl
ERR_INVALID_ARGSignal name already used in configuration
a_util::result::SUCCESSEverything went fine

◆ addTransformation()

a_util::result::Result addTransformation ( const std::string &  transformation_name,
const std::string &  transformation_type 
)

Add a transformation to use in mapping.

Parameters
[in]transformation_nameThe transformation name
[in]transformation_typeThe transformation type can be "Periodic", "Signal" or "Data"
Return values
ERR_INVALID_STATENo description found
ERR_INVALID_TYPEInconsistency with ddl
a_util::result::SUCCESSEverything went fine

◆ checkAssignmentReferences()

a_util::result::Result checkAssignmentReferences ( const MapAssignment assignment) const
private

Checks the configuration for consistency of a new assignment.

Parameters
[in]assignmentThe assignment to check
Return values
ERR_INVALID_ARGReference not found in Configuration
a_util::result::SUCCESSEverything went fine

◆ checkAssignmentType()

a_util::result::Result checkAssignmentType ( const std::string &  signal_name,
const ddl::dd::datamodel::StructType signal_struct,
const MapAssignment assignment 
) const
private

Checks the configuration for consistency of a new assignment.

Parameters
[in]signal_nameThe name of the target signal (for error list)
[in]signal_structThe ddl structure for the signal
[in]assignmentThe assignment to check
Return values
ERR_INVALID_TYPEDefinition is inconsistent with ddl
a_util::result::SUCCESSEverything went fine

◆ checkDDLConsistency()

a_util::result::Result checkDDLConsistency ( )

Checks the configuration for consistency with ddl representation (all types, transformations etc.

are known and present & many other problems)

Return values
ERR_INVALID_TYPEConfiguration is inconsistent with ddl, error list is populated and validity flags are set
a_util::result::SUCCESSEverything went fine, configuration is consistent

◆ checkMappingConsistency()

a_util::result::Result checkMappingConsistency ( )
private

Checks the mapping for consistency All referenced Sources and Transformations must exist in Mapping.

Return values
ERR_INVALID_ARGUnknown source or transformation is used
a_util::result::SUCCESSEverything went fine, configuration is consistent

◆ checkSignalName()

a_util::result::Result checkSignalName ( const std::string &  name) const
private

Checks the configuration for consistency of a new signal.

Parameters
[in]nameThe signal name
Return values
ERR_INVALID_ARGSignal name already used in configuration
a_util::result::SUCCESSEverything went fine

◆ checkSignalType()

a_util::result::Result checkSignalType ( const std::string &  type) const
private

Checks the configuration for consistency of a new signal.

Parameters
[in]typeThe type of the signal
Return values
ERR_INVALID_TYPEType not found in DataDefinition
a_util::result::SUCCESSEverything went fine

◆ checkTriggerType()

a_util::result::Result checkTriggerType ( const MapTriggerBase trigger) const
private

Checks the configuration for consistency of a new trigger.

Parameters
[in]triggerThe trigger to check
Return values
ERR_INVALID_TYPEDefinition is inconsistent with ddl
a_util::result::SUCCESSEverything went fine

◆ findTypeObject()

const ddl::dd::StructElementAccess findTypeObject ( const std::string &  struct_name,
const std::string &  path 
) const
private

find a DataDefinition data type within a struct given a path to the element

Parameters
[in]struct_nameName of the struct type
[in]pathPath to be found
[out]typeDestination type parameter
[out]array_sizeDestination array size parameter
Return values
ERR_NOT_FOUNDThe path is invalid or the type was not found
ERR_INVALID_TYPEUses dynamic type
a_util::result::SUCCESSThe type was found, type and array_size are filled

◆ getErrorList()

const MapErrorList& getErrorList ( ) const

Returns the error list, containing human readable error messages.

Note
The error list is filled by loadFromFile and loadFromDOM and is reset on every call
Returns
Const reference to the error list

◆ getSource() [1/2]

MapSource* getSource ( const std::string &  source_name)

Returns a specific mapping source from the configuration.

Parameters
[in]source_nameThe name of the source
Return values
Therequested source instance pointer
NULLif no source instance was found with that name

◆ getSource() [2/2]

const MapSource* getSource ( const std::string &  source_name) const

Returns a specific mapping source from the configuration.

Parameters
[in]source_nameThe name of the source
Return values
Therequested source instance pointer
NULLif no source instance was found with that name

◆ getTarget() [1/2]

MapTarget* getTarget ( const std::string &  target_name)

Returns a specific mapping target from the configuration.

Parameters
[in]target_nameThe name of the target
Return values
Therequested target instance pointer
NULLif no target instance was found with that name

◆ getTarget() [2/2]

const MapTarget* getTarget ( const std::string &  target_name) const

Returns a specific mapping target from the configuration.

Parameters
[in]target_nameThe name of the target
Return values
Therequested target instance pointer
NULLif no target instance was found with that name

◆ getTransformation() [1/2]

MapTransformationBase* getTransformation ( const std::string &  transformation_name)

Returns a specific transformation from the configuration.

Parameters
[in]transformation_nameThe name of the transformation
Return values
Therequested transformation base instance pointer
NULLif no transformation instance was found with that name

◆ getTransformation() [2/2]

const MapTransformationBase* getTransformation ( const std::string &  transformation_name) const

Returns a specific transformation from the configuration.

Parameters
[in]transformation_nameThe name of the transformation
Return values
Therequested transformation base instance pointer
NULLif no transformation instance was found with that name

◆ isConsistencyChecked()

bool isConsistencyChecked ( )

Returns bool flag indicating whether consistency of mapping with its DataDefinition was already checked.

Returns
Bool flag indicating whether consistency was checked

◆ isConsistent()

bool isConsistent ( )

Returns bool flag indicating consistency of mapping with its DataDefinition.

Returns
Bool flag indicating consistency

◆ loadFromDOM()

a_util::result::Result loadFromDOM ( a_util::xml::DOM dom,
uint32_t  flags = mc_load_mapping 
)

Import mapping configuration from a XML dom instance.

Parameters
[in]domThe dom instance from which to import
[in]flagsOptions for loading. See MapConfigFlags
Return values
ERR_INVALID_FLAGSInvalid flag combination
ERR_INVALID_STATENo description found
ERR_FAILEDConfiguration file is invalid (see error list for details)
ERR_INVALID_TYPEConfiguration uses unknown DataDefinition types (see error list for details)
a_util::result::SUCCESSEverything went fine

◆ loadFromDOMWithoutDDLConsistency()

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.

Parameters
[in]domThe dom instance from which to import
[in]flagsOptions for loading. See MapConfigFlags
Return values
ERR_INVALID_FLAGSInvalid flag combination
ERR_FAILEDConfiguration file is invalid (see error list for details)
a_util::result::SUCCESSEverything went fine

◆ loadFromFile()

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()

Parameters
[in]file_pathThe file path to the configuration file
[in]flagsOptions for loading. See MapConfigFlags
Return values
ERR_INVALID_FILEDOM Import from file failed (see error list for details)
seeloadFromDOM()

◆ loadMappingFromDOM()

static a_util::result::Result loadMappingFromDOM ( a_util::xml::DOM dom,
MapConfiguration tmp_config 
)
staticprivate

Import mapping configuration from a XML dom instance.

Parameters
[in]domThe dom instance from which to import
[out]tmp_configThe temporary configuration to create
Return values
ERR_INVALID_ARGDOM does not contains a valid mapping
a_util::result::SUCCESSEverything went fine

◆ loadPartiallyFromDOM()

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 with the DataDefinition description Each element has a validity flag representing its consistency.

Parameters
[in]domThe dom instance from which to import
[in]flagsOptions for loading. See MapConfigFlags
Return values
ERR_INVALID_FLAGSInvalid flag combination
ERR_FAILEDConfiguration file is invalid (see error list for details)
ERR_INVALID_TYPEConfiguration uses unknown DataDefinition types (see error list for details)
a_util::result::SUCCESSEverything went fine

◆ loadPartiallyFromFile()

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 loaded even if it is not consistent with the DataDefinition description Each element has a validity flag representing its consistency.

Parameters
[in]file_pathThe file path to the configuration file
[in]flagsOptions for loading. See MapConfigFlags
Return values
ERR_INVALID_FILEDOM Import from file failed (see error list for details)
seeloadPartiallyFromDOM()

◆ merge()

a_util::result::Result merge ( const MapConfiguration other)
private

merge another configuration into this one

Parameters
[in]otherThe other instance to be merged
Return values
ERR_INVALID_ARGType conflict
a_util::result::SUCCESSEverything went fine

◆ modifyDD()

Modify the reference ddl description Set the new ddl description and check mapping consistency.

Parameters
[in]ddlThe DataDefinition information base used for type lookup
Note
This call does not imply a internal Reset call
Return values
ERR_INVALID_TYPEConfiguration is inconsistent with ddl, mapping validity updated
a_util::result::SUCCESSEverything went fine

◆ removeSource()

a_util::result::Result removeSource ( const std::string &  name)

Remove a source signal from the configuration All connections using this source will be deleted.

Parameters
[in]nameThe name of the target
Return values
ERR_NOT_FOUNDSource not found
a_util::result::SUCCESSEverything went fine

◆ removeTarget()

a_util::result::Result removeTarget ( const std::string &  name)

Remove a target signal from the configuration All connections using this source will be deleted.

Parameters
[in]nameThe name of the target
Return values
ERR_NOT_FOUNDTarget not found
a_util::result::SUCCESSEverything went fine

◆ removeTransformation()

a_util::result::Result removeTransformation ( const std::string &  transformation_name)

Remove a transformation.

Parameters
[in]transformation_nameThe transformation name
Return values
ERR_NOT_FOUNDTransformation not found
a_util::result::SUCCESSEverything went fine

◆ repairConfigReferences()

void repairConfigReferences ( MapConfiguration config)
private

Set reference to new configuration.

Parameters
[in]configThe configuration to reference

◆ reset()

void reset ( )

Resets the entire map configuration to its initial, empty state.

Note
The ddl description remains untouched by this
Returns
Nothing but doxygen won't shut up if I dont write anything here

◆ resetDD()

Resets the reference DD.

Note
This call implies an internal Reset call, the configuration is reset
Return values
a_util::result::SUCCESSEverything went fine

◆ resetErrors()

a_util::result::Result resetErrors ( )

Clear error list and verify DataDefinition Description exists.

Return values
ERR_INVALID_STATENo description found
a_util::result::SUCCESSEverything went fine

◆ setDD()

Set the reference DD.

Parameters
[in]ddThe DataDefinition information base used for type lookup
Note
This call implies an internal Reset call, the configuration is reset
Return values
a_util::result::SUCCESSEverything went fine

◆ setDDWithoutConsistency()

a_util::result::Result setDDWithoutConsistency ( const ddl::dd::DataDefinition ddl)

Set the reference Data description without consistency check.

Parameters
[in]ddlThe DataDefinition information base used for type lookup
Return values
a_util::result::SUCCESSEverything went fine

◆ setHeaderDDPaths()

a_util::result::Result setHeaderDDPaths ( const std::string &  ddl_path)

Set the ddl paths attribute in configuration header.

Return values
a_util::result::SUCCESSEverything went fine

◆ setHeaderDescription()

a_util::result::Result setHeaderDescription ( const std::string &  desc)

Set the description in configuration header.

Return values
a_util::result::SUCCESSEverything went fine

◆ writeToDOM()

Export mapping configuration to a XML dom instance.

Parameters
[in]domThe dom instance from which to import
Return values
ERR_INVALID_STATENo description found
ERR_FAILEDConfiguration is invalid (see error list for details)
ERR_INVALID_TYPEConfiguration uses unknown DataDefinition types (see error list for details)
a_util::result::SUCCESSEverything went fine

◆ writeToFile()

a_util::result::Result writeToFile ( const std::string &  file_path)

Export mapping configuration to a file Call writeToDOM() and wirte DOM to file.

Parameters
[in]file_pathThe file path to the configuration file
Return values
ERR_INVALID_FILECan not write in file (see error list for details)
seewriteToDOM()

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