|
|
Entity is the superclass for all MemoryX memory chunks. More...
#include <MemoryX/core/entity/Entity.h>
Inheritance diagram for Entity:Public Member Functions | |
| void | __decRef () override |
| template<typename T> | |
| IceInternal::Handle< T > | addWrapper (T *wrapper) |
| Add EntityWrapper to entity. | |
| EntityPtr | clone (const Ice::Current &c=Ice::emptyCurrent) const |
| void | deserialize (const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override |
| Subclasses should use serializable attributes and consider these methods final. | |
| bool | equals (const EntityBasePtr &otherEntity, const ::Ice::Current &=Ice::emptyCurrent) const override |
| equals computes if two Entity instances are equal. | |
| bool | equalsAttributes (const EntityBasePtr &otherEntity, const ::Ice::Current &=Ice::emptyCurrent) const override |
| equalsAttributes computes if two Entity instances are equal. | |
| virtual EntityRefBaseList | getAllParentRefs (bool includeMetaEntities=true) const |
| Retrieve all parents by traversing the whole hierarchy. | |
| virtual std::vector< std::string > | getAllParentsAsStringList () const |
| EntityAttributeBasePtr | getAttribute (const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) const override |
| Retrieve attribute from entity. | |
| memoryx::NameList | getAttributeNames (const ::Ice::Current &=Ice::emptyCurrent) const override |
| Retrieve list of all attribute names. | |
| virtual armarx::VariantPtr | getAttributeValue (const ::std::string &attrName) const |
| Retrieve value of an attribute from entity. | |
| virtual EntityRefBaseList | getDirectParentRefs () const |
| Retrieve parent entity references. | |
| ::std::string | getId (const ::Ice::Current &=Ice::emptyCurrent) const override |
| Retrieve id of this entity which is an integer in string representation. | |
| ::std::string | getName (const ::Ice::Current &=Ice::emptyCurrent) const override |
| Retrieve name of this entity. | |
| template<typename T> | |
| IceInternal::Handle< T > | getWrapper () |
| Retrieve EntityWrapper that has previously been added with Entity::addWrapper(). | |
| bool | hasAttribute (const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) const override |
| Check whether this entity has an attribute with the given name. | |
| Ice::ObjectPtr | ice_clone () const override |
| bool | isMetaEntity (const ::Ice::Current &=Ice::emptyCurrent) const override |
| Indicates whether this entity only contains meta information. | |
| void | putAttribute (const ::memoryx::EntityAttributeBasePtr &attr, const ::Ice::Current &=Ice::emptyCurrent) override |
| Store attribute in entity. | |
| template<typename T> | |
| void | putAttribute (const std::string &attrName, T attrValue, ProbabilityMeasureBasePtr uncertainty=ProbabilityMeasureBasePtr()) |
| Create and store attribute from name, value, and optionally uncertainty measure. | |
| void | removeAttribute (const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) override |
| Remove attribute with given name from entity. | |
| void | serialize (const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override |
| Subclasses should use serializable attributes and consider these methods final. | |
| virtual void | setDirectParentRefs (const EntityRefBaseList &entityRefs) |
| Replace parent entity references. | |
| void | setId (const ::std::string &id, const ::Ice::Current &=Ice::emptyCurrent) override |
| Set id of this entity. | |
| void | setMetaEntity (bool isMetaEntity, const ::Ice::Current &=Ice::emptyCurrent) override |
| Mark this entity as meta (i.e. | |
| void | setName (const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override |
| Set name of this entity. | |
Static Public Member Functions | |
| static EntityPtr | CreateGenericEntity () |
| Creates an entity without any convenience getter/setter functions. | |
Protected Member Functions | |
| Entity () | |
| Entity (const Entity &source) | |
| void | ice_postUnmarshal () override |
| void | ice_preMarshal () override |
| void | output (std::ostream &stream) const |
| ~Entity () override | |
Protected Attributes | |
| std::mutex | attributesMutex |
| std::shared_mutex | entityMutex |
| AbstractEntityWrapperBaseList | wrappers |
| std::recursive_mutex | wrappersMutex |
Friends | |
| template<class BaseClass, class VariantClass> | |
| class | armarx::GenericFactory |
| std::ostream & | operator<< (std::ostream &stream, const Entity &rhs) |
| std::ostream & | operator<< (std::ostream &stream, const EntityBasePtr &rhs) |
| std::ostream & | operator<< (std::ostream &stream, const EntityPtr &rhs) |
Entity is the superclass for all MemoryX memory chunks.
An entity can be stored within different memory types (WorkingMemory, LTM, ...) and can be serialized to a database for persistence. Each entity is identified with an id, which is unique within a scope define by the memory processes (so it depends on the memory type and entity type). Further, each entity has a friendly name identifying its content.
Entities contain an arbitrary set of attributes (see memoryx::EntityAttribute). This mechanism allows to add new attributes on the fly, without changing the declaration of the entity. Further, all subclasses of entities use this attribute mechanism to store their properties.
Convenient access to the attributes can be realized by implementing a subclass off memory::AbstractAttributeWrapper. Wrappers map the attributes to c++ functions. Further extended functionality such as grid file attachement to attributes can be implemented in the wrapper. Wrappers are registered to the entity with the addWrapper() method. Only one wrapper of a specific type can be added.
|
inlineprotected |
|
overrideprotected |
|
override |
|
inline |
Add EntityWrapper to entity.
EntityWrapper provide a specific view on the entity and allow convenient c++ style access to the attributes of the entity. They can also handle associated files. See e.g. EntityWrappers::SimoxObjectWrapper
Example:
SimoxObjectWrapperPtr simoxWrapper = entity->addWrapper(new SimoxObjectWrapper(...)); ManipulationObjectPtr mo = simoxWrapper->getManipulationObject();
| pointer | to wrapper |
| EntityPtr clone | ( | const Ice::Current & | c = Ice::emptyCurrent | ) | const |
|
static |
Creates an entity without any convenience getter/setter functions.
This should only be used with GenericSegments (
|
override |
Subclasses should use serializable attributes and consider these methods final.
Exemplary JSON deserialization:
|
override |
equals computes if two Entity instances are equal.
Attributes of both Entities in the order Id, name, and attributes have to match in order to be considered equal.
| otherEntity | the Entity to compare with |
|
override |
equalsAttributes computes if two Entity instances are equal.
Attributes of both Entities in the order name and attributes have to match in order to be considered equal.
| otherEntity | the Entity to compare with |
|
virtual |
Retrieve all parents by traversing the whole hierarchy.
|
virtual |
|
override |
Retrieve attribute from entity.
If attribute is not present, a new attribute is returned. See Entity::hasAttribute()
| attrName | name of the attribute |
|
override |
Retrieve list of all attribute names.
|
virtual |
Retrieve value of an attribute from entity.
If attribute is not present, a new variant is returned. See Entity::hasAttribute()
| attrName | name of the attribute |
|
virtual |
Retrieve parent entity references.
|
override |
Retrieve id of this entity which is an integer in string representation.
Id is unique within one memory segment and is returned by e.g. WorkingMemorySegment::addEntity()
|
override |
Retrieve name of this entity.
|
inline |
Retrieve EntityWrapper that has previously been added with Entity::addWrapper().
|
override |
Check whether this entity has an attribute with the given name.
| attrName | name of the attribute |
|
override |
|
overrideprotected |
|
overrideprotected |
|
override |
Indicates whether this entity only contains meta information.
|
protected |
|
override |
Store attribute in entity.
Name is taken from attribute member. Overwrites attribute with the same name if present.
| attr | pointer to attribute |
|
inline |
Create and store attribute from name, value, and optionally uncertainty measure.
Overwrites attribute with the same name if present.
| attrName | name of the attribute |
| attrValue | value of the attribute |
| uncertainty | probability measure |
|
override |
Remove attribute with given name from entity.
| attrName | name of the attribute |
|
override |
Subclasses should use serializable attributes and consider these methods final.
Exemplary JSON serialization:
|
virtual |
Replace parent entity references.
| entityRefs | new parent entity references |
|
override |
Set id of this entity.
Id is usually set by adding the entity to a memory segment.
| id | as string |
|
override |
Mark this entity as meta (i.e.
it only contains meta information)
| isMetaEntity |
|
override |
Set name of this entity.
| name |
|
friend |
|
friend |
|
friend |
|
friend |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
mutableprotected |