Go to the documentation of this file.
28 #include <MemoryX/interface/core/EntityBase.h>
29 #include <MemoryX/interface/core/ProbabilityMeasures.h>
33 #include <type_traits>
34 #include <shared_mutex>
247 virtual public memoryx::EntityBase
262 ::std::string
getId(const ::Ice::Current& = Ice::emptyCurrent)
const override;
268 void setId(const ::std::string&
id, const ::Ice::Current& = Ice::emptyCurrent)
override;
274 ::std::string
getName(const ::Ice::Current& = Ice::emptyCurrent)
const override;
280 void setName(const ::std::string& name, const ::Ice::Current& = Ice::emptyCurrent)
override;
286 bool isMetaEntity(const ::Ice::Current& = Ice::emptyCurrent)
const override;
304 virtual EntityRefBaseList
getAllParentRefs(
bool includeMetaEntities =
true)
const;
319 bool hasAttribute(const ::std::string& attrName, const ::Ice::Current& = Ice::emptyCurrent)
const override;
326 EntityAttributeBasePtr
getAttribute(const ::std::string& attrName, const ::Ice::Current& = Ice::emptyCurrent)
const override;
340 void putAttribute(const ::memoryx::EntityAttributeBasePtr& attr, const ::Ice::Current& = Ice::emptyCurrent)
override;
351 ProbabilityMeasureBasePtr uncertainty = ProbabilityMeasureBasePtr())
353 const ::memoryx::EntityAttributeBasePtr attr =
new EntityAttribute(attrName);
364 void removeAttribute(const ::std::string& attrName, const ::Ice::Current& = Ice::emptyCurrent)
override;
371 memoryx::NameList
getAttributeNames(const ::Ice::Current& = Ice::emptyCurrent)
const override;
382 bool equals(
const EntityBasePtr& otherEntity, const ::Ice::Current& = Ice::emptyCurrent)
const override;
393 bool equalsAttributes(
const EntityBasePtr& otherEntity, const ::Ice::Current& = Ice::emptyCurrent)
const override;
410 static_assert(!std::is_same_v<T, EntityWrappers::AbstractEntityWrapper>,
411 "The template parameter for Entity::addWrapper should not be of base class AbstractEntityWrapper");
413 static_assert(!std::is_base_of_v<T, EntityWrappers::AbstractEntityWrapper>,
414 "The template parameter for Entity::addWrapper needs to inherit from AbstractEntityWrapper");
420 wrapper->setEntity(
this);
439 static_assert(!std::is_same_v<T, EntityWrappers::AbstractEntityWrapper>,
440 "The template parameter for Entity::getWrapper should not be of base class AbstractEntityWrapper");
442 static_assert(!std::is_base_of_v<T, EntityWrappers::AbstractEntityWrapper>,
443 "The template parameter for Entity::getWrapper needs to inherit from AbstractEntityWrapper");
445 AbstractEntityWrapperBaseList::iterator iter =
wrappers.begin();
478 void serialize(
const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent)
const override;
491 void deserialize(
const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent)
override;
495 template <
class BaseClass,
class VariantClass>
500 void output(std::ostream& stream)
const;
529 friend std::ostream&
operator<<(std::ostream& stream,
const EntityBasePtr& rhs)
531 stream << EntityPtr::dynamicCast(rhs);
void ice_preMarshal() override
void setMetaEntity(bool isMetaEntity, const ::Ice::Current &=Ice::emptyCurrent) override
Mark this entity as meta (i.e.
The Variant class is described here: Variants.
const armarx::VariantTypeId EntityRef
void putAttribute(const std::string &attrName, T attrValue, ProbabilityMeasureBasePtr uncertainty=ProbabilityMeasureBasePtr())
Create and store attribute from name, value, and optionally uncertainty measure.
void putAttribute(const ::memoryx::EntityAttributeBasePtr &attr, const ::Ice::Current &=Ice::emptyCurrent) override
Store attribute in entity.
::std::string getName(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve name of this entity.
::std::string getId(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve id of this entity which is an integer in string representation.
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Subclasses should use serializable attributes and consider these methods final.
EntityAttributeBasePtr getAttribute(const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve attribute from entity.
void removeAttribute(const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) override
Remove attribute with given name from entity.
EntityPtr clone(const Ice::Current &c=Ice::emptyCurrent) const
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Subclasses should use serializable attributes and consider these methods final.
memoryx::NameList getAttributeNames(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve list of all attribute names.
static EntityPtr CreateGenericEntity()
Creates an entity without any convenience getter/setter functions.
friend std::ostream & operator<<(std::ostream &stream, const EntityBasePtr &rhs)
void ice_postUnmarshal() override
void output(std::ostream &stream) const
virtual armarx::VariantPtr getAttributeValue(const ::std::string &attrName) const
Retrieve value of an attribute from entity.
friend std::ostream & operator<<(std::ostream &stream, const EntityPtr &rhs)
virtual void setDirectParentRefs(const EntityRefBaseList &entityRefs)
Replace parent entity references.
Ice::ObjectPtr ice_clone() const override
IceInternal::Handle< T > getWrapper()
Retrieve EntityWrapper that has previously been added with Entity::addWrapper().
virtual EntityRefBaseList getDirectParentRefs() const
Retrieve parent entity references.
std::mutex attributesMutex
IceInternal::Handle< T > addWrapper(T *wrapper)
Add EntityWrapper to entity.
virtual std::vector< std::string > getAllParentsAsStringList() const
virtual EntityRefBaseList getAllParentRefs(bool includeMetaEntities=true) const
Retrieve all parents by traversing the whole hierarchy.
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
void setId(const ::std::string &id, const ::Ice::Current &=Ice::emptyCurrent) override
Set id of this entity.
AbstractEntityWrapperBaseList wrappers
bool equalsAttributes(const EntityBasePtr &otherEntity, const ::Ice::Current &=Ice::emptyCurrent) const override
equalsAttributes computes if two Entity instances are equal.
std::shared_mutex entityMutex
bool hasAttribute(const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) const override
Check whether this entity has an attribute with the given name.
friend std::ostream & operator<<(std::ostream &stream, const Entity &rhs)
Attribute of MemoryX entities.
std::shared_ptr< Object > ObjectPtr
bool equals(const EntityBasePtr &otherEntity, const ::Ice::Current &=Ice::emptyCurrent) const override
equals computes if two Entity instances are equal.
void setName(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Set name of this entity.
std::recursive_mutex wrappersMutex
bool isMetaEntity(const ::Ice::Current &=Ice::emptyCurrent) const override
Indicates whether this entity only contains meta information.