EntityAttribute Class Reference

Attribute of MemoryX entities. More...

#include <MemoryX/core/entity/EntityAttribute.h>

+ Inheritance diagram for EntityAttribute:

Public Member Functions

void addElement (const ::memoryx::AttributeElement &elem, const ::Ice::Current &=Ice::emptyCurrent) override
 Adds attribute element (=value+uncertainty) to the attribute.
 
void addValue (const ::armarx::VariantBasePtr &val, const ::Ice::Current &=Ice::emptyCurrent) override
 Adds value to the end of attribute values list.
 
void addValueWithUncertainty (const ::armarx::VariantBasePtr &val, const ::memoryx::ProbabilityMeasureBasePtr &uncertainty, const ::Ice::Current &=Ice::emptyCurrent) override
 Adds value along with the corresponding uncertainty to the end of attribute values list.
 
void clear (const ::Ice::Current &=Ice::emptyCurrent) override
 Clears all values.
 
EntityAttributePtr clone (const Ice::Current &c=Ice::emptyCurrent) const
 
void deserialize (const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
 
 EntityAttribute (const EntityAttribute &other)
 Constructs a copy from another EntityAttribute instance.
 
 EntityAttribute (const std::string &name)
 Constructs a new EntityAttribute.
 
 EntityAttribute (const std::string &name, const armarx::VariantBasePtr &val)
 Constructs a new EntityAttribute and assigns a value.
 
::memoryx::AttributeElement getElement (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieves the attribute element (=value+uncertainty).
 
::memoryx::AttributeElement getElementAt (::Ice::Int index, const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieves an attribute element (=value+uncertainty) with a given index.
 
::std::string getName (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieve name of the attribute.
 
::memoryx::ProbabilityMeasureBasePtr getUncertainty (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieves the uncertainty of the attribute value.
 
::memoryx::ProbabilityMeasureBasePtr getUncertaintyAt (::Ice::Int index, const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieve the uncertainty of the value at a given index from the list of values stored in the attribute.
 
::armarx::VariantBasePtr getValue (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieves the value of the attribute.
 
::armarx::VariantBasePtr getValueAt (::Ice::Int index, const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieve the value at a given index from the list of values stored in the attribute.
 
bool hasValue (const ::armarx::VariantBasePtr &val, const ::Ice::Current &=Ice::emptyCurrent) const override
 Checks whether the value val is currently stored in the attribute.
 
Ice::ObjectPtr ice_clone () const override
 
void removeValueAt (::Ice::Int index, const ::Ice::Current &=Ice::emptyCurrent) override
 Removes the value at a given index from the list of values stored in the attribute.
 
void serialize (const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
 
void setElement (const ::memoryx::AttributeElement &elem, const ::Ice::Current &=Ice::emptyCurrent) override
 Sets (single) attribute element (=value+uncertainty) to the attribute.
 
void setValue (const ::armarx::VariantBasePtr &val, const ::Ice::Current &=Ice::emptyCurrent) override
 Sets (single) value of the attribute.
 
void setValueWithUncertainty (const ::armarx::VariantBasePtr &val, const ::memoryx::ProbabilityMeasureBasePtr &uncertainty, const ::Ice::Current &=Ice::emptyCurrent) override
 Sets (single) value of the attribute along with the corresponding uncertainty.
 
::Ice::Int size (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieve number of values stored with the attribute.
 
 ~EntityAttribute () override
 

Protected Attributes

std::recursive_mutex valuesMutex
 

Friends

template<class IceBaseClass, class DerivedClass>
class ::armarx::GenericFactory
 
std::ostream & operator<< (std::ostream &stream, const EntityAttribute &rhs)
 
std::ostream & operator<< (std::ostream &stream, const EntityAttributeBasePtr &rhs)
 
std::ostream & operator<< (std::ostream &stream, const EntityAttributePtr &rhs)
 

Detailed Description

Attribute of MemoryX entities.

Each memory entity can have an arbitraty number of attributes, identified by their names. Essentially, they are stored as a map std::string -> EntityAttribute. EntityAttribute has one or many AttributeElements, each of them representing a value with uncertainty as a pair (value, probabilityMeasure). See documentation of memoryx::AttributeElement for details on what types are supported as values.

Constructor & Destructor Documentation

◆ EntityAttribute() [1/3]

EntityAttribute ( const std::string & name)

Constructs a new EntityAttribute.

Parameters
namethe attribute is identified via this name

◆ EntityAttribute() [2/3]

EntityAttribute ( const std::string & name,
const armarx::VariantBasePtr & val )

Constructs a new EntityAttribute and assigns a value.

Parameters
namethe attribute is identified via this name
valuevalue for this attribute

◆ EntityAttribute() [3/3]

EntityAttribute ( const EntityAttribute & other)

Constructs a copy from another EntityAttribute instance.

Parameters
otherEntityAttribute to copy from

◆ ~EntityAttribute()

~EntityAttribute ( )
override

Member Function Documentation

◆ addElement()

void addElement ( const ::memoryx::AttributeElement & elem,
const ::Ice::Current & = Ice::emptyCurrent )
override

Adds attribute element (=value+uncertainty) to the attribute.

Parameters
elemattribute element to add

◆ addValue()

void addValue ( const ::armarx::VariantBasePtr & val,
const ::Ice::Current & = Ice::emptyCurrent )
override

Adds value to the end of attribute values list.

Uncertainty assumed to be empty (=unknown/not specified).

Parameters
valvalue to add

◆ addValueWithUncertainty()

void addValueWithUncertainty ( const ::armarx::VariantBasePtr & val,
const ::memoryx::ProbabilityMeasureBasePtr & uncertainty,
const ::Ice::Current & = Ice::emptyCurrent )
override

Adds value along with the corresponding uncertainty to the end of attribute values list.

This is equivalent to clearing the attribute value list (clear()) and calling addValueWithUncertainty().

Parameters
valvalue to set
uncertaintyprobability distribution representing the value uncertainty

◆ clear()

void clear ( const ::Ice::Current & = Ice::emptyCurrent)
override

Clears all values.

The attribute will not contain any value after calling clear.

◆ clone()

EntityAttributePtr clone ( const Ice::Current & c = Ice::emptyCurrent) const

◆ deserialize()

void deserialize ( const armarx::ObjectSerializerBasePtr & serializer,
const ::Ice::Current & c = Ice::emptyCurrent )
override

◆ getElement()

AttributeElement getElement ( const ::Ice::Current & = Ice::emptyCurrent) const
override

Retrieves the attribute element (=value+uncertainty).

Corresponds to calling getElementAt(0).

Returns
uncertainty of attribute value

◆ getElementAt()

AttributeElement getElementAt ( ::Ice::Int index,
const ::Ice::Current & = Ice::emptyCurrent ) const
override

Retrieves an attribute element (=value+uncertainty) with a given index.

Returns
uncertainty of attribute value

◆ getName()

std::string getName ( const ::Ice::Current & = Ice::emptyCurrent) const
override

Retrieve name of the attribute.

Returns
attribute name

◆ getUncertainty()

ProbabilityMeasureBasePtr getUncertainty ( const ::Ice::Current & = Ice::emptyCurrent) const
override

Retrieves the uncertainty of the attribute value.

Corresponds to calling getUncertaintyAt(0)

Returns
uncertainty of attribute value

◆ getUncertaintyAt()

ProbabilityMeasureBasePtr getUncertaintyAt ( ::Ice::Int index,
const ::Ice::Current & = Ice::emptyCurrent ) const
override

Retrieve the uncertainty of the value at a given index from the list of values stored in the attribute.

Parameters
indexof value
Returns
uncertainty of value at index

◆ getValue()

armarx::VariantBasePtr getValue ( const ::Ice::Current & = Ice::emptyCurrent) const
override

Retrieves the value of the attribute.

Corresponds to calling getValueAt(0)

Returns
value of attribute

◆ getValueAt()

armarx::VariantBasePtr getValueAt ( ::Ice::Int index,
const ::Ice::Current & = Ice::emptyCurrent ) const
override

Retrieve the value at a given index from the list of values stored in the attribute.

Parameters
indexof value
Returns
value at index

◆ hasValue()

bool hasValue ( const ::armarx::VariantBasePtr & val,
const ::Ice::Current & c = Ice::emptyCurrent ) const
override

Checks whether the value val is currently stored in the attribute.

If attribute stores multiple values, each of them will be compared with val and in case of at least one match the result will be positive.

NOTE: currently, this method can be used for String values ONLY! To make it applicable for other datatypes, general comparison method for armarx::Variant should be implemented in Core first.

Returns
true if attribute has a value val, false otherwise

◆ ice_clone()

Ice::ObjectPtr ice_clone ( ) const
override

◆ removeValueAt()

void removeValueAt ( ::Ice::Int index,
const ::Ice::Current & = Ice::emptyCurrent )
override

Removes the value at a given index from the list of values stored in the attribute.

Parameters
indexof value

◆ serialize()

void serialize ( const armarx::ObjectSerializerBasePtr & serializer,
const ::Ice::Current & c = Ice::emptyCurrent ) const
override

◆ setElement()

void setElement ( const ::memoryx::AttributeElement & elem,
const ::Ice::Current & = Ice::emptyCurrent )
override

Sets (single) attribute element (=value+uncertainty) to the attribute.

This is equivalent to clearing the attribute value list (clear()) and calling addValue().

Parameters
elemattribute element to set

◆ setValue()

void setValue ( const ::armarx::VariantBasePtr & val,
const ::Ice::Current & = Ice::emptyCurrent )
override

Sets (single) value of the attribute.

Uncertainty assumed to be empty (=unknown/not specified). This is equivalent to clearing the attribute value list (clear()) and calling addValue().

Parameters
valvalue to set

◆ setValueWithUncertainty()

void setValueWithUncertainty ( const ::armarx::VariantBasePtr & val,
const ::memoryx::ProbabilityMeasureBasePtr & uncertainty,
const ::Ice::Current & = Ice::emptyCurrent )
override

Sets (single) value of the attribute along with the corresponding uncertainty.

This is equivalent to clearing the attribute values list (clear()) and calling addValueWithUncertainty().

Parameters
valvalue to set
uncertaintyprobability distribution representing the value uncertainty

◆ size()

Ice::Int size ( const ::Ice::Current & = Ice::emptyCurrent) const
override

Retrieve number of values stored with the attribute.

Returns
number of values

Friends And Related Symbol Documentation

◆ ::armarx::GenericFactory

template<class IceBaseClass, class DerivedClass>
friend class ::armarx::GenericFactory
friend

◆ operator<< [1/3]

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

◆ operator<< [2/3]

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

◆ operator<< [3/3]

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

Member Data Documentation

◆ valuesMutex

std::recursive_mutex valuesMutex
mutableprotected

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