ADTF
Loading...
Searching...
No Matches
ddl::mapping::datamodel::Assignment Class Reference

Datamodel assignment class used in Target. More...

#include <datamodel_configuration_items.h>

Inherits ddl::utility::TypeAccessListSubject< Assignment >, and ddl::dd::datamodel::InfoMap.

Classes

struct  FunctionCall
 FunctionCall type. More...
 

Public Types

enum class  Type { source_value , const_value , function_call }
 the type of the assignment More...
 
using SourceValue = ParameterValue::SourceValue
 SourceValue type.
 
using ConstValue = ParameterValue::ConstValue
 ConstValue type.
 
using ParameterValues = ddl::utility::TypeAccessList<ParameterValue, Assignment>
 ParameterValues type within Assignment.
 

Public Member Functions

 Assignment ()=delete
 no CTOR
 
 Assignment (const Assignment &other)
 copy CTOR
 
 Assignment (Assignment &&other)
 move CTOR
 
 Assignment (const std::string &to_target_value_name, const SourceValue &from_source_value)
 CTOR.
 
 Assignment (const std::string &to_target_value_name, const ConstValue &from_const_value)
 CTOR.
 
 Assignment (const std::string &to_target_value_name, const FunctionCall &from_module_call, const std::vector< ParameterValue > &parameter_values={})
 CTOR.
 
 ~Assignment ()
 DTOR.
 
Assignment & operator= (const Assignment &other)
 copy operator
 
Assignment & operator= (Assignment &&other)
 move operator, which assigns like the copy operator
 
bool operator== (const Assignment &other) const
 equality operator
 
bool operator!= (const Assignment &other) const
 inequality operator
 
Type getType () const
 Get the type.
 
const std::string & getTo () const
 Get the assignment value to assign to.
 
const std::string & getName () const
 Get the name of the assignment value to assign to (the same as getTo)
 
void setTo (const std::string &to)
 Set the assignment value to assign to.
 
SourceValue getSourceValue () const
 Get the source value if type is set to Type::source_value.
 
void setAsSourceValue (const SourceValue &source_value)
 Set as source value assignment.
 
ConstValue getConstValue () const
 Get the const value if type is set to Type::const_value.
 
void setAsConstValue (const ConstValue &const_value)
 Set as const value assignment.
 
FunctionCall getFunctionCall () const
 Get the function call value if type is set to Type::function_call.
 
void setAsFunctionCall (const FunctionCall &function_call)
 Set as function call assignment.
 
void setAsFunctionCall (const FunctionCall &module_call, const std::vector< ParameterValue > &parameter_values)
 Set as module call assignment and the parameters to use for the function.
 
const ParameterValues & getParameterValues () const
 Get the ParameterValues.
 
ParameterValues & getParameterValues ()
 Get the ParameterValues.
 
- Public Member Functions inherited from ddl::dd::datamodel::InfoMap
 InfoMap ()=default
 CTOR.
 
 InfoMap (const InfoMap &)
 copy CTOR
 
 InfoMap (InfoMap &&)
 move CTOR
 
InfoMap & operator= (const InfoMap &)
 copy assignment operator
 
InfoMap & operator= (InfoMap &&)
 move assignment operator
 
template<typename INFO_T>
const INFO_T * getInfo () const noexcept
 Get the Info Pointer.
 
template<typename INFO_T>
INFO_T * getInfo () noexcept
 Get the Info Pointer.
 
template<typename INFO_T>
void setInfo (const std::shared_ptr< INFO_T > &info)
 Set the Info object as shared pointer.
 

Detailed Description

Datamodel assignment class used in Target.

Remarks
This class is observable within a ddl::utility::TypeAccessList

Member Enumeration Documentation

◆ Type

the type of the assignment

Enumerator
source_value 

The assignment is a source value assignment.

See also
Assignment::getSourceValue, SourceValue
const_value 

The assignment is a const value assignment.

See also
Assignment::getConstValue, ConstValue
function_call 

The assignment is a function call assignment.

See also
Assignment::getFunctionCall, FunctionCall

Constructor & Destructor Documentation

◆ Assignment() [1/5]

ddl::mapping::datamodel::Assignment::Assignment ( const Assignment & other)

copy CTOR

Parameters
otherthe object to copy

◆ Assignment() [2/5]

ddl::mapping::datamodel::Assignment::Assignment ( Assignment && other)

move CTOR

Parameters
otherthe object to move

◆ Assignment() [3/5]

ddl::mapping::datamodel::Assignment::Assignment ( const std::string & to_target_value_name,
const SourceValue & from_source_value )

CTOR.

the type will be set to Type::source_value

Parameters
to_target_value_namethe target value name to assign to
from_source_valuethe source value to take the value from

◆ Assignment() [4/5]

ddl::mapping::datamodel::Assignment::Assignment ( const std::string & to_target_value_name,
const ConstValue & from_const_value )

CTOR.

the type will be set to Type::const_value

Parameters
to_target_value_namethe target value name to assign to
from_const_valuethe const value to set

◆ Assignment() [5/5]

ddl::mapping::datamodel::Assignment::Assignment ( const std::string & to_target_value_name,
const FunctionCall & from_module_call,
const std::vector< ParameterValue > & parameter_values = {} )

CTOR.

The assignment will lead into a call of the given function within the given module instance. The type will be set to Type::function_call. The target value is set as kind of:

to_target_value = module_name.function_name(param1, param2)
Parameters
to_target_value_namethe target value name to assign to
from_module_callthe module name and function to call and set the return value from
parameter_valuesthe parameters for the function call

Member Function Documentation

◆ getConstValue()

ConstValue ddl::mapping::datamodel::Assignment::getConstValue ( ) const

Get the const value if type is set to Type::const_value.

Returns
ConstValue

◆ getFunctionCall()

FunctionCall ddl::mapping::datamodel::Assignment::getFunctionCall ( ) const

Get the function call value if type is set to Type::function_call.

Returns
FunctionCall

◆ getName()

const std::string & ddl::mapping::datamodel::Assignment::getName ( ) const

Get the name of the assignment value to assign to (the same as getTo)

Returns
const std::string&

◆ getParameterValues() [1/2]

ParameterValues & ddl::mapping::datamodel::Assignment::getParameterValues ( )

Get the ParameterValues.

Returns
ParameterValues&

◆ getParameterValues() [2/2]

const ParameterValues & ddl::mapping::datamodel::Assignment::getParameterValues ( ) const

Get the ParameterValues.

Returns
const ParameterValues&

◆ getSourceValue()

SourceValue ddl::mapping::datamodel::Assignment::getSourceValue ( ) const

Get the source value if type is set to Type::source_value.

Returns
SourceValue

◆ getTo()

const std::string & ddl::mapping::datamodel::Assignment::getTo ( ) const

Get the assignment value to assign to.

Returns
const std::string&

◆ getType()

Type ddl::mapping::datamodel::Assignment::getType ( ) const

Get the type.

◆ operator!=()

bool ddl::mapping::datamodel::Assignment::operator!= ( const Assignment & other) const

inequality operator

Parameters
otherthe other object to compare
Returns
true is not equal
false is equal

◆ operator=() [1/2]

Assignment & ddl::mapping::datamodel::Assignment::operator= ( Assignment && other)

move operator, which assigns like the copy operator

Parameters
otherthe object to move
Returns
Assignment&
Exceptions
ddl::dd::Errorif the assignment is in a list that has another item of the name

◆ operator=() [2/2]

Assignment & ddl::mapping::datamodel::Assignment::operator= ( const Assignment & other)

copy operator

Assigns the values through the setters, so an owning list is notified of each change like for the setters. The name is assigned first with setTo, and if the list refuses it, the assignment stays unchanged.

Parameters
otherthe object to copy
Returns
Assignment&
Exceptions
ddl::dd::Errorif the assignment is in a list that has another item of the name

◆ operator==()

bool ddl::mapping::datamodel::Assignment::operator== ( const Assignment & other) const

equality operator

Parameters
otherthe other object to compare
Returns
true is equal
false is not equal

◆ setAsConstValue()

void ddl::mapping::datamodel::Assignment::setAsConstValue ( const ConstValue & const_value)

Set as const value assignment.

the type will be set to Type::const_value

Parameters
const_valuethe const value to set
Remarks
This change is observable, the additional_info is set to "values"!

◆ setAsFunctionCall() [1/2]

void ddl::mapping::datamodel::Assignment::setAsFunctionCall ( const FunctionCall & function_call)

Set as function call assignment.

The assignment will lead into a call of the given function instance instance. The type will be set to Type::function_call The target value is set as kind of:

to_target_value = function_name(param1, param2)
Parameters
function_callthe function call value to set
Remarks
This change is observable, the additional_info is set to "values"!

◆ setAsFunctionCall() [2/2]

void ddl::mapping::datamodel::Assignment::setAsFunctionCall ( const FunctionCall & module_call,
const std::vector< ParameterValue > & parameter_values )

Set as module call assignment and the parameters to use for the function.

The assignment will lead into a call of the given function within the given module instance with the given parameter_values The type will be set to Type::function_call

Parameters
module_callthe module call value to set
parameter_valuesthe module call parameters to set
Remarks
This change is observable, the additional_info is set to "values" and may also lead into parameters added/removed events!

◆ setAsSourceValue()

void ddl::mapping::datamodel::Assignment::setAsSourceValue ( const SourceValue & source_value)

Set as source value assignment.

the type will be set to Type::source_value

Parameters
source_valuethe source value to set
Remarks
This change is observable, the additional_info is set to "values"!

◆ setTo()

void ddl::mapping::datamodel::Assignment::setTo ( const std::string & to)

Set the assignment value to assign to.

Parameters
tothe name of the assignment value

The documentation for this class was generated from the following file: