ConditionCheck Class Reference

#include <ArmarXCore/observers/ConditionCheck.h>

+ Inheritance diagram for ConditionCheck:

Public Types

using ChannelRegistry = armarx::ChannelRegistry
 Creates a new ConditionCheck instance. More...
 

Public Member Functions

virtual ConditionCheckclone ()
 Clones the current check. More...
 
 ConditionCheck ()
 Creates and initializes a ConditionCheck instance. More...
 
virtual ConditionCheckPtr createInstance (const CheckConfiguration &configuration, const ChannelRegistry &channelRegistry)
 
void evaluateCondition (const DataFieldRegistry &dataFields)
 Evaluates the condition based on the given registry of data fields. More...
 
bool getFulFilled ()
 Retrieve result of a condition evaluation initiated by evaluateCondition. More...
 
void reset ()
 Resets the status flags of the check such as check results. More...
 
 ~ConditionCheck () override
 Destructor. More...
 

Protected Member Functions

void addSupportedType (VariantTypeId dataFieldType=0, ParameterTypeList parameterTypes=ParameterTypeList())
 Add a supported type for elementary condition check marks pairs of (dataFieldType,EvaluationTypes) More...
 
virtual bool evaluate (const StringVariantMap &dataFields)
 Evaluate the condition based on the current data field values. More...
 
const VariantgetParameter (int index)
 Retrieve parameters of check. More...
 
void setNumberParameters (int numberParameters)
 Sets the number of paramaters required for this check. More...
 

Static Protected Member Functions

static ParameterTypeList createParameterTypeList (int numberTypes,...)
 

Friends

std::ostream & operator<< (std::ostream &stream, const ConditionCheck &rhs)
 
std::ostream & operator<< (std::ostream &stream, const ConditionCheckPtr &rhs)
 

Detailed Description

A ConditionCheck implements a check on the sensor data stream of a Sensor-Actor Unit. ConditionCheck instances can be arbitrarily combined to complex Terms.

All custom condition checks should inherit from this base class.

Definition at line 56 of file ConditionCheck.h.

Member Typedef Documentation

◆ ChannelRegistry

using ChannelRegistry = armarx::ChannelRegistry

Creates a new ConditionCheck instance.

It checks if channel and datafield named in configuration are availabel and if the type of the datafield is supported by the check.

Parameters
configurationThe configuration of the check to instantiate
channelRegistryThe current registry of available channels
Exceptions
InvalidConditionExceptionif the requested channel or datafield could not be found.
Returns
Pointer to a ConditionCheck instance

Definition at line 83 of file ConditionCheck.h.

Constructor & Destructor Documentation

◆ ConditionCheck()

Creates and initializes a ConditionCheck instance.

Definition at line 38 of file ConditionCheck.cpp.

◆ ~ConditionCheck()

~ConditionCheck ( )
inlineoverride

Destructor.

Definition at line 68 of file ConditionCheck.h.

Member Function Documentation

◆ addSupportedType()

void addSupportedType ( VariantTypeId  dataFieldType = 0,
ParameterTypeList  parameterTypes = ParameterTypeList() 
)
protected

Add a supported type for elementary condition check marks pairs of (dataFieldType,EvaluationTypes)

Parameters
dataFieldTypevalid type for the dataField variant. Set to 0 for: all types are supported.
parameterTypestypes of the parameters

Definition at line 250 of file ConditionCheck.cpp.

+ Here is the caller graph for this function:

◆ clone()

◆ createInstance()

ConditionCheckPtr createInstance ( const CheckConfiguration &  configuration,
const ChannelRegistry channelRegistry 
)
virtual

Definition at line 44 of file ConditionCheck.cpp.

◆ createParameterTypeList()

ParameterTypeList createParameterTypeList ( int  numberTypes,
  ... 
)
staticprotected

Definition at line 259 of file ConditionCheck.cpp.

+ Here is the caller graph for this function:

◆ evaluate()

virtual bool evaluate ( const StringVariantMap dataFields)
inlineprotectedvirtual

Evaluate the condition based on the current data field values.

This method should be overwritten in order to create a custom condition check.

Parameters
dataFieldsThe values of the relevant data fields to check against
Returns
In this implementation, returns always true

Reimplemented in ConditionCheckEquals, ConditionCheckChanged, ConditionCheckEqualsWithTolerance, ConditionCheckInRange, ConditionCheckMagnitudeInRange, ConditionCheckLarger, ConditionCheckSmaller, ConditionCheckUpdated, ConditionCheckValid, ConditionCheckApproxPose, ConditionCheckMagnitudeSmaller, ConditionCheckMagnitudeLarger, ConditionCheckStringContains, and ConditionCheckEqualsPose.

Definition at line 163 of file ConditionCheck.h.

◆ evaluateCondition()

void evaluateCondition ( const DataFieldRegistry &  dataFields)

Evaluates the condition based on the given registry of data fields.

The result of the evaluation can be accessed by calling getFulFilled.

Parameters
dataFieldsThe registry of data fields to consider

Definition at line 82 of file ConditionCheck.cpp.

◆ getFulFilled()

bool getFulFilled ( )

Retrieve result of a condition evaluation initiated by evaluateCondition.

Returns
true if test was successful, false otherwise

Definition at line 146 of file ConditionCheck.cpp.

◆ getParameter()

const Variant & getParameter ( int  index)
protected

Retrieve parameters of check.

Parameters
indexof the parameter
Returns
reference to check parameter

Definition at line 151 of file ConditionCheck.cpp.

+ Here is the caller graph for this function:

◆ reset()

void reset ( )

Resets the status flags of the check such as check results.

Definition at line 75 of file ConditionCheck.cpp.

◆ setNumberParameters()

void setNumberParameters ( int  numberParameters)
protected

Sets the number of paramaters required for this check.

Parameters
numberParametersnumber of parameters

Definition at line 245 of file ConditionCheck.cpp.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  stream,
const ConditionCheck rhs 
)
friend

Definition at line 117 of file ConditionCheck.h.

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  stream,
const ConditionCheckPtr rhs 
)
friend

Definition at line 123 of file ConditionCheck.h.


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