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. More...
 
void addValue (const ::armarx::VariantBasePtr &val, const ::Ice::Current &=Ice::emptyCurrent) override
 Adds value to the end of attribute values list. More...
 
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. More...
 
void clear (const ::Ice::Current &=Ice::emptyCurrent) override
 Clears all values. More...
 
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. More...
 
 EntityAttribute (const std::string &name)
 Constructs a new EntityAttribute. More...
 
 EntityAttribute (const std::string &name, const armarx::VariantBasePtr &val)
 Constructs a new EntityAttribute and assigns a value. More...
 
::memoryx::AttributeElement getElement (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieves the attribute element (=value+uncertainty). More...
 
::memoryx::AttributeElement getElementAt (::Ice::Int index, const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieves an attribute element (=value+uncertainty) with a given index. More...
 
::std::string getName (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieve name of the attribute. More...
 
::memoryx::ProbabilityMeasureBasePtr getUncertainty (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieves the uncertainty of the attribute value. More...
 
::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. More...
 
::armarx::VariantBasePtr getValue (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieves the value of the attribute. More...
 
::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. More...
 
bool hasValue (const ::armarx::VariantBasePtr &val, const ::Ice::Current &=Ice::emptyCurrent) const override
 Checks whether the value val is currently stored in the attribute. More...
 
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. More...
 
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. More...
 
void setValue (const ::armarx::VariantBasePtr &val, const ::Ice::Current &=Ice::emptyCurrent) override
 Sets (single) value of the attribute. More...
 
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. More...
 
::Ice::Int size (const ::Ice::Current &=Ice::emptyCurrent) const override
 Retrieve number of values stored with the attribute. More...
 
 ~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.

Definition at line 48 of file EntityAttribute.h.

Constructor & Destructor Documentation

◆ EntityAttribute() [1/3]

EntityAttribute ( const std::string &  name)

Constructs a new EntityAttribute.

Parameters
namethe attribute is identified via this name

Definition at line 35 of file EntityAttribute.cpp.

◆ 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

Definition at line 40 of file EntityAttribute.cpp.

+ Here is the call graph for this function:

◆ EntityAttribute() [3/3]

EntityAttribute ( const EntityAttribute other)

Constructs a copy from another EntityAttribute instance.

Parameters
otherEntityAttribute to copy from

Definition at line 46 of file EntityAttribute.cpp.

+ Here is the call graph for this function:

◆ ~EntityAttribute()

~EntityAttribute ( )
override

Definition at line 74 of file EntityAttribute.cpp.

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

Definition at line 220 of file EntityAttribute.cpp.

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

◆ 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

Definition at line 132 of file EntityAttribute.cpp.

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

◆ 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

Definition at line 137 of file EntityAttribute.cpp.

+ Here is the caller graph for this function:

◆ clear()

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

Clears all values.

The attribute will not contain any value after calling clear.

Definition at line 243 of file EntityAttribute.cpp.

+ Here is the caller graph for this function:

◆ clone()

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

Definition at line 254 of file EntityAttribute.cpp.

+ Here is the caller graph for this function:

◆ deserialize()

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

Definition at line 302 of file EntityAttribute.cpp.

+ Here is the call graph for this function:

◆ 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

Definition at line 226 of file EntityAttribute.cpp.

+ Here is the call graph for this function:

◆ 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

Definition at line 231 of file EntityAttribute.cpp.

+ Here is the caller graph for this function:

◆ getName()

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

Retrieve name of the attribute.

Returns
attribute name

Definition at line 82 of file EntityAttribute.cpp.

◆ 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

Definition at line 183 of file EntityAttribute.cpp.

+ Here is the call graph for this function:

◆ 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

Definition at line 194 of file EntityAttribute.cpp.

+ Here is the caller graph for this function:

◆ 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

Definition at line 178 of file EntityAttribute.cpp.

+ Here is the call graph for this function:

◆ 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

Definition at line 188 of file EntityAttribute.cpp.

+ Here is the caller graph for this function:

◆ 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

Definition at line 155 of file EntityAttribute.cpp.

◆ ice_clone()

Ice::ObjectPtr ice_clone ( ) const
override

Definition at line 249 of file EntityAttribute.cpp.

+ Here is the call graph for this function:

◆ 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

Definition at line 202 of file EntityAttribute.cpp.

◆ serialize()

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

Definition at line 280 of file EntityAttribute.cpp.

◆ 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

Definition at line 212 of file EntityAttribute.cpp.

+ Here is the call graph for this function:

◆ 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

Definition at line 87 of file EntityAttribute.cpp.

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

◆ 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

Definition at line 103 of file EntityAttribute.cpp.

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

◆ size()

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

Retrieve number of values stored with the attribute.

Returns
number of values

Definition at line 237 of file EntityAttribute.cpp.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ::armarx::GenericFactory

friend class ::armarx::GenericFactory
friend

Definition at line 53 of file EntityAttribute.h.

◆ operator<< [1/3]

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

Definition at line 228 of file EntityAttribute.h.

◆ operator<< [2/3]

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

Definition at line 240 of file EntityAttribute.h.

◆ operator<< [3/3]

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

Definition at line 234 of file EntityAttribute.h.

Member Data Documentation

◆ valuesMutex

std::recursive_mutex valuesMutex
mutableprotected

Definition at line 222 of file EntityAttribute.h.


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