ADTF  3.18.2
MapEnumTableTransformation

MapEnumTableTransformation represents a transformation between to enumerations. More...

Inheritance diagram for MapEnumTableTransformation:
[legend]

Public Types

using ConversionMap = std::map< int64_t, int64_t >
 Alias for the conversion map.
 

Public Member Functions

 MapEnumTableTransformation (MapConfiguration *config, const std::string &name)
 CTOR. More...
 
const std::string & getEnumFrom () const
 Returns the name of the source enumeration.
 
const std::string & getEnumTo () const
 Returns the name of the target enumeration.
 
a_util::result::Result setEnums (const std::string &enum_from, const std::string &enum_to)
 Set the name of the target and source enumerations. More...
 
int64_t getDefault () const
 Returns default value.
 
std::string getDefaultStr () const
 Returns default value as string.
 
a_util::result::Result setDefault (const std::string &default_value)
 Set default value as string. More...
 
const ConversionMapgetConversions () const
 Returns conversion list.
 
const std::map< std::string, std::string > & getConversionsStr () const
 Returns conversion list as string.
 
a_util::result::Result addConversion (const std::string &from, const std::string &to)
 Add a conversion as string. More...
 
a_util::result::Result removeConversion (const std::string &from)
 Remove a conversion as string. More...
 
bool isEqual (const MapTransformationBase &other) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
double evaluate (double value) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
MapTransformationBaseclone () const
 nodoc
 
- Public Member Functions inherited from MapTransformationBase
 MapTransformationBase (MapConfiguration *config, const std::string &name)
 CTOR. More...
 
virtual ~MapTransformationBase ()
 DTOR.
 
const std::string & getName () const
 Returns the name of the transformation.
 
bool isValid () const
 Returns the validity for the current description.
 

Private Types

typedef std::map< std::string, std::string > MapStrConversionList
 

Private Member Functions

a_util::result::Result loadFromDom (const a_util::xml::DOMElement &dom_element)
 Initializes the transformation from a target-dom element. More...
 
a_util::result::Result writeToDOM (a_util::xml::DOMElement &dom_element) const
 Export transformation to a XML dom element. More...
 
a_util::result::Result convertValuesWithDDL ()
 Convert string values to integer values. More...
 
a_util::result::Result setEnumsStr (const std::string &enum_from, const std::string &enum_to)
 Set the name of the target and source enumerations. More...
 
a_util::result::Result setDefaultStr (const std::string &default_value)
 Set default value as string. More...
 
a_util::result::Result addConversionStr (const std::string &from, const std::string &to)
 Add a conversion as string. More...
 

Private Attributes

std::string _enum_from
 
std::string _enum_to
 
std::string _default_value
 
MapStrConversionList _conversions
 
int64_t _default_int
 
ConversionMap _conversions_int
 

Detailed Description

MapEnumTableTransformation represents a transformation between to enumerations.

Definition at line 203 of file map_transformation.h.

Constructor & Destructor Documentation

◆ MapEnumTableTransformation()

MapEnumTableTransformation ( MapConfiguration config,
const std::string &  name 
)

CTOR.

Parameters
[in]configThe configuration
[in]nameThe transformation name

Member Function Documentation

◆ addConversion()

a_util::result::Result addConversion ( const std::string &  from,
const std::string &  to 
)

Add a conversion as string.

Parameters
[in]fromstring for source value
[in]tostring for target value
Return values
a_util::result::SUCCESSEverything went fine

◆ addConversionStr()

a_util::result::Result addConversionStr ( const std::string &  from,
const std::string &  to 
)
private

Add a conversion as string.

Parameters
[in]fromstring for source value
[in]tostring for target value
Return values
a_util::result::SUCCESSEverything went fine

◆ convertValuesWithDDL()

a_util::result::Result convertValuesWithDDL ( )
private

Convert string values to integer values.

The integer values were not filled before, as the ddl is necessary for this

Return values
ERR_INVALID_TYPEInconsistency with ddl
a_util::result::SUCCESSEverything went fine

◆ loadFromDom()

a_util::result::Result loadFromDom ( const a_util::xml::DOMElement dom_element)
private

Initializes the transformation from a target-dom element.

Parameters
[in]dom_elementThe dom element from which to import
Return values
ERR_INVALID_ARGMissing attribute
a_util::result::SUCCESSEverything went fine

◆ removeConversion()

a_util::result::Result removeConversion ( const std::string &  from)

Remove a conversion as string.

Parameters
[in]fromstring for source value
Return values
a_util::result::SUCCESSEverything went fine

◆ setDefault()

a_util::result::Result setDefault ( const std::string &  default_value)

Set default value as string.

Parameters
[in]default_valuestring for default value
Return values
a_util::result::SUCCESSEverything went fine

◆ setDefaultStr()

a_util::result::Result setDefaultStr ( const std::string &  default_value)
private

Set default value as string.

Parameters
[in]default_valuestring for default value
Return values
a_util::result::SUCCESSEverything went fine

◆ setEnums()

a_util::result::Result setEnums ( const std::string &  enum_from,
const std::string &  enum_to 
)

Set the name of the target and source enumerations.

Parameters
[in]enum_frominput enumeration name
[in]enum_tooutput enumeration name
Return values
ERR_INVALID_TYPEEnums not found in ddl
a_util::result::SUCCESSEverything went fine

◆ setEnumsStr()

a_util::result::Result setEnumsStr ( const std::string &  enum_from,
const std::string &  enum_to 
)
private

Set the name of the target and source enumerations.

Parameters
[in]enum_frominput enumeration name
[in]enum_tooutput enumeration name
Return values
a_util::result::SUCCESSEverything went fine

◆ writeToDOM()

a_util::result::Result writeToDOM ( a_util::xml::DOMElement dom_element) const
private

Export transformation to a XML dom element.

Parameters
[in]dom_elementThe dom element to be written
Return values
a_util::result::SUCCESSEverything went fine