ParameterMapping Class Reference

This class maps parameters from several source dictionaries to one input dictionary. The mapping depends on an instance of ParameterMappingIceBase, in which the mapping is specified.
More...

#include <ArmarXCore/statechart/ParameterMapping.h>

+ Inheritance diagram for ParameterMapping:

Public Member Functions

void addMappingEntry (MappingSource mappingSource, const std::string &sourceKey, const std::string &targetKey, VariantContainerBasePtr value=nullptr)
 
virtual ParameterMappingPtr clone () const
 Returns a new instance of ParameterMapping with the contents of this instance. More...
 
::Ice::ObjectPtr ice_clone () const override
 Returns a new instance of ParameterMapping with the contents of this instance. More...
 
ParameterMappingPtr mapFromDataField (const DataFieldIdentifierBasePtr &dataFieldIdentifier, const std::string &targetKey, const Ice::Current &c=Ice::emptyCurrent)
 Adds an entry to the ParameterMapping, that maps the value of the datafield entry to the targetKey's value of the target dictionary. More...
 
ParameterMappingPtr mapFromEvent (const std::string &bothKeys, const Ice::Current &c=Ice::emptyCurrent)
 
ParameterMappingPtr mapFromEvent (const std::string &eventKey, const std::string &targetKey, const Ice::Current &c=Ice::emptyCurrent)
 Adds an entry to the ParameterMapping, that maps the sourceKey's value from the event parameters of the transition to the targetKey's value of the target dictionary. More...
 
ParameterMappingPtr mapFromOutput (const std::string &bothKeys, const Ice::Current &c=Ice::emptyCurrent)
 
ParameterMappingPtr mapFromOutput (const std::string &sourceKey, const std::string &targetKey, const Ice::Current &c=Ice::emptyCurrent)
 Adds an entry to the ParameterMapping, that maps the sourceKey's value from the output parameters of the last state to the targetKey's value of the target dictionary. More...
 
ParameterMappingPtr mapFromParent (const std::string &bothKeys, const Ice::Current &c=Ice::emptyCurrent)
 
ParameterMappingPtr mapFromParent (const std::string &parentKey, const std::string &targetKey, const Ice::Current &c=Ice::emptyCurrent)
 Adds an entry to the ParameterMapping, that maps the sourceKey's value from the parent's input parameters of the current state to the targetKey's value of the target dictionary. More...
 
ParameterMappingoperator= (const ParameterMapping &rhs)
 
ParameterMappingPtr setSourcePriority (int priorityLevel, MappingSource mappingSrc, const Ice::Current &c=Ice::emptyCurrent)
 Adds a priority for a specific source dictionary to the mapping. More...
 
ParameterMappingPtr setTargetDictToGreedy (bool on=true)
 Sets the behaviour of the mapping into the target dictionary to greedy. More...
 
- Public Member Functions inherited from Logging
SpamFilterDataPtr deactivateSpam (float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
 disables the logging for the current line for the given amount of seconds. More...
 
MessageTypeT getEffectiveLoggingLevel () const
 
 Logging ()
 
void setLocalMinimumLoggingLevel (MessageTypeT level)
 With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set. More...
 
void setTag (const LogTag &tag)
 
void setTag (const std::string &tagName)
 
virtual ~Logging ()
 

Static Public Member Functions

static ParameterMappingPtr createMapping ()
 Creates a new instance of a ParameterMapping. Since the constructors are private, this method must be used, to create a new ParameterMapping. More...
 
static std::string MappingSourceToString (MappingSource mappingSource)
 
static MappingSource StringToMappingSource (const std::string &mappingSourceString)
 

Protected Member Functions

ParameterMappingPtr _addSourceDictionary (MappingSource mappingSrc, const StringVariantContainerBaseMap &sourceDict, const Ice::Current &c=Ice::emptyCurrent)
 
void _applyMapping (StateParameterMap &targetDictionary)
 This function applies a given mapping to the given inputdictionary. More...
 
void _fillFromDataField (StateParameterMap &targetDictionary)
 
void _fillFromValues (StateParameterMap &targetDictionary)
 
StringVariantContainerBaseMap::const_iterator _findSourceEntry (const std::string sourceKey, const StringVariantContainerBaseMap &sourceDict, int destWildcardIndex, const Ice::StringSeq &fieldsDest)
 
void _greedyMapping (StateParameterMap &targetDictionary, StringVariantContainerBaseMap &sourceDictionary)
 
StringVariantContainerBaseMap::const_iterator _hasMappingEntry (const std::string &keyDestination, const StringVariantContainerBaseMap &sourceDict, MappingSource allowedMappingSource)
 Checks wether the mapping has an entry like keyDestination that maps onto a parameter of mapSource. More...
 
 ~ParameterMapping () override
 
- Protected Member Functions inherited from Logging
bool checkLogLevel (MessageTypeT level) const
 
const LogSenderPtrgetLogSender () const
 Retrieve log sender. More...
 
LogSenderPtr loghelper (const char *file, int line, const char *function) const
 

Static Protected Member Functions

static void _addMissingSources (PriorityMap &priorityMap)
 
static Ice::StringSeq _getFields (std::string source, char seperator='.')
 Takes a string and seperates the string by the seperator-char. More...
 
static void _setStatechartContext (StatechartContext *__context)
 

Friends

template<class EventType , class StateType >
class FinalStateBase
 
class StateBase
 
class StatechartContext
 
class StateController
 

Additional Inherited Members

- Protected Attributes inherited from Logging
MessageTypeT minimumLoggingLevel
 
SpamFilterDataPtr spamFilter
 
LogTag tag
 

Detailed Description

This class maps parameters from several source dictionaries to one input dictionary. The mapping depends on an instance of ParameterMappingIceBase, in which the mapping is specified.

An example mapping looks like this:
sourceKey: State1.timeout
targetKey: State2.globaltimeout
This would map the value of the outputparameter of a state named "State1.timeout" on the value of the inputparameter of a state named "State2.globaltimeout".

Also wildcards are possible.
sourceKey: State1.*
targetKey: State2.*
This mapping would try to map all parameters of a source on the inputparameters of a target state. But only those that are matching exactly on the wildcard level.

Definition at line 64 of file ParameterMapping.h.

Constructor & Destructor Documentation

◆ ~ParameterMapping()

~ParameterMapping ( )
inlineoverrideprotected

Definition at line 165 of file ParameterMapping.h.

Member Function Documentation

◆ _addMissingSources()

void _addMissingSources ( PriorityMap &  priorityMap)
staticprotected

Definition at line 461 of file ParameterMapping.cpp.

+ Here is the caller graph for this function:

◆ _addSourceDictionary()

ParameterMappingPtr _addSourceDictionary ( MappingSource  mappingSrc,
const StringVariantContainerBaseMap &  sourceDict,
const Ice::Current &  c = Ice::emptyCurrent 
)
protected

Definition at line 518 of file ParameterMapping.cpp.

◆ _applyMapping()

void _applyMapping ( StateParameterMap &  targetDictionary)
protected

This function applies a given mapping to the given inputdictionary.

All source-dictionary pointers can be set to NULL if the dictionary should not be considered. The function applyStandardMapping() is executed everytime a mapping is applied with this function. Afterwards the specified (if any) mapping is applied and overwrites the standard mapping.

Definition at line 50 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ _fillFromDataField()

void _fillFromDataField ( StateParameterMap &  targetDictionary)
protected

Definition at line 164 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ _fillFromValues()

void _fillFromValues ( StateParameterMap &  targetDictionary)
protected

Definition at line 216 of file ParameterMapping.cpp.

◆ _findSourceEntry()

StringVariantContainerBaseMap::const_iterator _findSourceEntry ( const std::string  sourceKey,
const StringVariantContainerBaseMap &  sourceDict,
int  destWildcardIndex,
const Ice::StringSeq &  fieldsDest 
)
protected

Definition at line 388 of file ParameterMapping.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFields()

Ice::StringSeq _getFields ( std::string  source,
char  seperator = '.' 
)
staticprotected

Takes a string and seperates the string by the seperator-char.

Inserts all strings between the seperator-chars into a vector of strings (without the seperator-char).
E.g. 'State.angle' transforms the 'State' and 'angle'

Definition at line 446 of file ParameterMapping.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _greedyMapping()

void _greedyMapping ( StateParameterMap &  targetDictionary,
StringVariantContainerBaseMap &  sourceDictionary 
)
protected

Definition at line 151 of file ParameterMapping.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _hasMappingEntry()

StringVariantContainerBaseMap::const_iterator _hasMappingEntry ( const std::string &  keyDestination,
const StringVariantContainerBaseMap &  sourceDict,
MappingSource  allowedMappingSource 
)
protected

Checks wether the mapping has an entry like keyDestination that maps onto a parameter of mapSource.

Definition at line 324 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ _setStatechartContext()

void _setStatechartContext ( StatechartContext __context)
staticprotected

Definition at line 595 of file ParameterMapping.cpp.

◆ addMappingEntry()

void addMappingEntry ( MappingSource  mappingSource,
const std::string &  sourceKey,
const std::string &  targetKey,
VariantContainerBasePtr  value = nullptr 
)

Definition at line 525 of file ParameterMapping.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clone()

ParameterMappingPtr clone ( ) const
virtual

Returns a new instance of ParameterMapping with the contents of this instance.

Definition at line 248 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ createMapping()

ParameterMappingPtr createMapping ( )
static

Creates a new instance of a ParameterMapping. Since the constructors are private, this method must be used, to create a new ParameterMapping.

Returns
Pointer to the new instance of a ParameterMapping.

Definition at line 539 of file ParameterMapping.cpp.

+ Here is the caller graph for this function:

◆ ice_clone()

Ice::ObjectPtr ice_clone ( ) const
override

Returns a new instance of ParameterMapping with the contents of this instance.

Definition at line 242 of file ParameterMapping.cpp.

+ Here is the caller graph for this function:

◆ mapFromDataField()

ParameterMappingPtr mapFromDataField ( const DataFieldIdentifierBasePtr dataFieldIdentifier,
const std::string &  targetKey,
const Ice::Current &  c = Ice::emptyCurrent 
)

Adds an entry to the ParameterMapping, that maps the value of the datafield entry to the targetKey's value of the target dictionary.

Parameters
sourceKeyThe key in the source dictionary.
targetKeyThe key in the target dictionary.
Returns
Shared pointer to this for fluent interface.

Definition at line 582 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ mapFromEvent() [1/2]

ParameterMappingPtr mapFromEvent ( const std::string &  bothKeys,
const Ice::Current &  c = Ice::emptyCurrent 
)

Definition at line 576 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ mapFromEvent() [2/2]

ParameterMappingPtr mapFromEvent ( const std::string &  eventKey,
const std::string &  targetKey,
const Ice::Current &  c = Ice::emptyCurrent 
)

Adds an entry to the ParameterMapping, that maps the sourceKey's value from the event parameters of the transition to the targetKey's value of the target dictionary.

Parameters
sourceKeyThe key in the source dictionary.
targetKeyThe key in the target dictionary.
Returns
Shared pointer to this for fluent interface.

Definition at line 570 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ mapFromOutput() [1/2]

ParameterMappingPtr mapFromOutput ( const std::string &  bothKeys,
const Ice::Current &  c = Ice::emptyCurrent 
)

Definition at line 552 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ mapFromOutput() [2/2]

ParameterMappingPtr mapFromOutput ( const std::string &  sourceKey,
const std::string &  targetKey,
const Ice::Current &  c = Ice::emptyCurrent 
)

Adds an entry to the ParameterMapping, that maps the sourceKey's value from the output parameters of the last state to the targetKey's value of the target dictionary.

Parameters
sourceKeyThe key in the source dictionary.
targetKeyThe key in the target dictionary.
Returns
Shared pointer to this for fluent interface.

Definition at line 546 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ mapFromParent() [1/2]

ParameterMappingPtr mapFromParent ( const std::string &  bothKeys,
const Ice::Current &  c = Ice::emptyCurrent 
)

Definition at line 564 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ mapFromParent() [2/2]

ParameterMappingPtr mapFromParent ( const std::string &  parentKey,
const std::string &  targetKey,
const Ice::Current &  c = Ice::emptyCurrent 
)

Adds an entry to the ParameterMapping, that maps the sourceKey's value from the parent's input parameters of the current state to the targetKey's value of the target dictionary.

Parameters
sourceKeyThe key in the source dictionary.
targetKeyThe key in the target dictionary.
Returns
Shared pointer to this for fluent interface.

Definition at line 558 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ MappingSourceToString()

std::string MappingSourceToString ( MappingSource  mappingSource)
static

Definition at line 271 of file ParameterMapping.cpp.

◆ operator=()

ParameterMapping & operator= ( const ParameterMapping rhs)

Definition at line 255 of file ParameterMapping.cpp.

+ Here is the call graph for this function:

◆ setSourcePriority()

ParameterMappingPtr setSourcePriority ( int  priorityLevel,
MappingSource  mappingSrc,
const Ice::Current &  c = Ice::emptyCurrent 
)

Adds a priority for a specific source dictionary to the mapping.

The priorities determine which source dictionary is chosen, if two entries of different source dictionaries map onto the same target parameter. Each priority level can only be used once. If the priority level already exists, an eLogicError exception is thrown.

Exceptions
eLogicError
Parameters
priorityLevelAny int value possible. High value -> Higher Priority
mappingSrcThe mapping source for which this priority level should apply.
Returns
Shared pointer to this for fluent interface.

Definition at line 503 of file ParameterMapping.cpp.

◆ setTargetDictToGreedy()

ParameterMappingPtr setTargetDictToGreedy ( bool  on = true)

Sets the behaviour of the mapping into the target dictionary to greedy.

Greedy means, that all parameters of all source dictionaries that have the same key value will be mapped into the target dictionary, whether or not they are specified in the mapping.

Parameters
onIf true, the mapping is greedy.
Returns
Shared pointer to this for fluent interface.

Definition at line 589 of file ParameterMapping.cpp.

◆ StringToMappingSource()

MappingSource StringToMappingSource ( const std::string &  mappingSourceString)
static

Definition at line 295 of file ParameterMapping.cpp.

Friends And Related Function Documentation

◆ FinalStateBase

friend class FinalStateBase
friend

Definition at line 161 of file ParameterMapping.h.

◆ StateBase

friend class StateBase
friend

Definition at line 159 of file ParameterMapping.h.

◆ StatechartContext

friend class StatechartContext
friend

Definition at line 162 of file ParameterMapping.h.

◆ StateController

friend class StateController
friend

Definition at line 160 of file ParameterMapping.h.


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