ParameterMapping Class Reference

This class maps parameters from several source dictionaries to one input dictionary. 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.
 
::Ice::ObjectPtr ice_clone () const override
 Returns a new instance of ParameterMapping with the contents of this instance.
 
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.
 
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.
 
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.
 
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.
 
ParameterMapping & operator= (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.
 
ParameterMappingPtr setTargetDictToGreedy (bool on=true)
 Sets the behaviour of the mapping into the target dictionary to greedy.
 
- 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.
 
MessageTypeT getEffectiveLoggingLevel () const
 
 Logging ()
 
void setLocalMinimumLoggingLevel (MessageTypeT level)
 With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set.
 
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.
 
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.
 
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.
 
 ~ParameterMapping () override
 
- Protected Member Functions inherited from Logging
bool checkLogLevel (MessageTypeT level) const
 
const LogSenderPtr & getLogSender () const
 Retrieve log sender.
 
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.
 
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.

Constructor & Destructor Documentation

◆ ~ParameterMapping()

~ParameterMapping ( )
inlineoverrideprotected

Member Function Documentation

◆ _addMissingSources()

void _addMissingSources ( PriorityMap & priorityMap)
staticprotected

◆ _addSourceDictionary()

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

◆ _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.

◆ _fillFromDataField()

void _fillFromDataField ( StateParameterMap & targetDictionary)
protected

◆ _fillFromValues()

void _fillFromValues ( StateParameterMap & targetDictionary)
protected

◆ _findSourceEntry()

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

◆ _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'

◆ _greedyMapping()

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

◆ _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.

◆ _setStatechartContext()

void _setStatechartContext ( StatechartContext * __context)
staticprotected

◆ addMappingEntry()

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

◆ clone()

ParameterMappingPtr clone ( ) const
virtual

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

◆ 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.

◆ ice_clone()

Ice::ObjectPtr ice_clone ( ) const
override

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

◆ 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.

◆ mapFromEvent() [1/2]

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

◆ 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.

◆ mapFromOutput() [1/2]

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

◆ 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.

◆ mapFromParent() [1/2]

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

◆ 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.

◆ MappingSourceToString()

std::string MappingSourceToString ( MappingSource mappingSource)
static

◆ operator=()

ParameterMapping & operator= ( const ParameterMapping & rhs)

◆ 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.

◆ 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.

◆ StringToMappingSource()

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

Friends And Related Symbol Documentation

◆ FinalStateBase

template<class EventType, class StateType>
friend class FinalStateBase
friend

◆ StateBase

friend class StateBase
friend

◆ StatechartContext

friend class StatechartContext
friend

◆ StateController

friend class StateController
friend

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