ObjectClassMemorySegment Class Reference

The object class segment is a specialized segment of the SegmentedMemory. More...

#include <MemoryX/libraries/memorytypes/segment/ObjectClassMemorySegment.h>

+ Inheritance diagram for ObjectClassMemorySegment:

Public Member Functions

ObjectClassList addPriorClassWithSubclasses (const std::string &className, const ::Ice::Current &=Ice::emptyCurrent) override
 Fetches a class and its ontological subclasses from prior knowledge and inserts the complete subtree in this segment. More...
 
ObjectClassList getClassWithSubclasses (const std::string &rootClassName, const ::Ice::Current &=Ice::emptyCurrent) override
 Retrieves complete ontological tree from this segment. More...
 
 ObjectClassMemorySegment (const PriorKnowledgeInterfacePrx &priorKnowledgePrx)
 Creates a new object class segment. More...
 
void removePriorClassWithSubclasses (const std::string &className, const ::Ice::Current &=Ice::emptyCurrent) override
 Removes a class and its ontological subclasses. More...
 
ObjectClassBasePtr updateClass (const std::string &className, const ObjectClassBasePtr &update, const ::Ice::Current &=Ice::emptyCurrent) override
 Update a class with the given entity. More...
 
- Public Member Functions inherited from WorkingMemoryEntitySegment< ObjectClass >
std::string addEntity (const EntityBasePtr &entity, const ::Ice::Current &c=Ice::emptyCurrent) override
 addEntity addes an entity to this segment. The registered fusion methods are applied in order to fuse the entity entry. More...
 
EntityIdList addEntityList (const EntityBaseList &entityList, const ::Ice::Current &c) override
 
void addFusionMethod (const ::memoryx::EntityFusionMethodBasePtr &fusionMethod, const ::Ice::Current &c=Ice::emptyCurrent) override
 
void clear (const ::Ice::Current &c=Ice::emptyCurrent) override
 
EntityBaseList getAllEntities (const Ice::Current &c=Ice::emptyCurrent) const override
 
EntityIdList getAllEntityIds (const Ice::Current &c=Ice::emptyCurrent) const override
 
EntityBaseList getEntitiesByAttrValue (const ::std::string &attrName, const ::std::string &attrValue) const
 
EntityBaseList getEntitiesByAttrValue (const ::std::string &attrName, const ::std::string &attrValue, const ::Ice::Current &c) const override
 
EntityBaseList getEntitiesByAttrValueList (const ::std::string &attrName, const NameList &attrValueList) const
 
EntityBaseList getEntitiesByAttrValueList (const ::std::string &attrName, const NameList &attrValueList, const ::Ice::Current &c) const override
 
EntityBasePtr getEntityById (const ::std::string &id) const
 
EntityBasePtr getEntityById (const ::std::string &id, const ::Ice::Current &c) const override
 
EntityBasePtr getEntityByName (const ::std::string &name) const
 
EntityBasePtr getEntityByName (const ::std::string &name, const ::Ice::Current &c) const override
 
EntityRefBasePtr getEntityRefById (const std::string &id, const Ice::Current &c) const override
 
EntityRefBasePtr getEntityRefByName (const std::string &name, const Ice::Current &c) const override
 
Ice::Identity getIceId (const ::Ice::Current &c) const override
 
IdEntityMap getIdEntityMap (const Ice::Current &c=Ice::emptyCurrent) const override
 
WorkingMemoryListenerInterfacePrx getListenerProxy (const ::Ice::Current &c=Ice::emptyCurrent) override
 getListener The topic on which changes are reported. More...
 
std::string getObjectTypeId (const ::Ice::Current &c=Ice::emptyCurrent) const override
 getObjectTypeId returns the ice_staticId() of the entities stored inside this WorkingMemorySegment More...
 
std::string getSegmentName (const ::Ice::Current &c=Ice::emptyCurrent) const override
 
bool hasEntityById (const std::string &entityId, const ::Ice::Current &c) const override
 
bool hasEntityByName (const std::string &entityName, const ::Ice::Current &c) const override
 
void print (const ::Ice::Current &c=Ice::emptyCurrent) const override
 
void removeAllEntities (const ::Ice::Current &c=Ice::emptyCurrent) override
 
void removeEntity (const ::std::string &id, const ::Ice::Current &c=Ice::emptyCurrent) override
 
void setEntityAttribute (const std::string &entityId, const EntityAttributeBasePtr &attribute, const ::Ice::Current &c) override
 
void setEntityAttributes (const std::string &entityId, const EntityAttributeList &attributeMap, const ::Ice::Current &c) override
 
Ice::Int size (const ::Ice::Current &c=Ice::emptyCurrent) const override
 
void updateEntity (const std::string &entityId, const EntityBasePtr &update, const ::Ice::Current &c=Ice::emptyCurrent) override
 
void updateEntity (const std::string &entityId, const EntityBasePtr &update, const Ice::StringSeq &deactivatedFusionMethods, const ::Ice::Current &c=Ice::emptyCurrent)
 
std::string upsertEntity (const std::string &entityId, const EntityBasePtr &newEntity, const ::Ice::Current &c=Ice::emptyCurrent) override
 
std::string upsertEntityByName (const std::string &entityName, const EntityBasePtr &newEntity, const ::Ice::Current &c=Ice::emptyCurrent) override
 
EntityIdList upsertEntityList (const EntityBaseList &entityList, const ::Ice::Current &c) override
 
 WorkingMemoryEntitySegment ()
 
- Public Member Functions inherited from SegmentUtilImplementations
EntityBaseList getEntityWithChildrenById (const std::string &id, bool includeMetaEntities, const Ice::Current &c=Ice::emptyCurrent) const override
 
EntityBaseList getEntityWithChildrenByName (const std::string &, bool includeMetaEntities, const Ice::Current &c=Ice::emptyCurrent) const override
 
std::string getJSONEntityById (const std::string &id, const Ice::Current &) const override
 
ScopedSharedLockPtr getReadLock (const Ice::Current &c) const
 
ScopedUniqueLockPtr getWriteLock (const Ice::Current &c) const
 
bool keepLockAlive (const std::string &token, const Ice::Current &) override
 
SegmentLockBasePtr lockSegment (const Ice::Current &c) override
 
 SegmentUtilImplementations ()
 
bool unlockSegment (const SegmentLockBasePtr &lock, const Ice::Current &c) override
 
bool unlockSegmentWithToken (const std::string &token, const Ice::Current &c) override
 

Static Public Member Functions

static bool ListContainsObject (const ObjectClassList &objects, ObjectClassBasePtr object)
 
static std::string ObjectsToString (const ObjectClassList &objects)
 
static Ice::StringSeq ObjectsToStringList (const ObjectClassList &objects)
 

Additional Inherited Members

- Public Types inherited from SegmentUtilImplementations
using ScopedSharedLock = std::unique_lock< std::shared_mutex >
 
using ScopedSharedLockPtr = std::unique_ptr< ScopedSharedLock >
 
using ScopedUniqueLock = std::unique_lock< std::shared_mutex >
 
using ScopedUniqueLockPtr = std::unique_ptr< ScopedSharedLock >
 
- Protected Member Functions inherited from WorkingMemoryEntitySegment< ObjectClass >
std::string addEntityThreadUnsafe (const EntityBasePtr &newEntity)
 adds the entity to the segment. More...
 
void fuseEntity (const EntityBasePtr &entity)
 
EntityBasePtr getEntityByIdUnsafe (const ::std::string &id) const
 
EntityBasePtr getEntityByNameThreadUnsafe (const ::std::string &name) const
 
bool hasEntityByIdThreadUnsafe (const std::string &entityId) const
 
void setListenerProxy (const WorkingMemoryListenerInterfacePrx &listenerProxy, const ::Ice::Current &c=Ice::emptyCurrent) override
 
void setParentMemory (const MemoryInterfacePtr &memory, const ::Ice::Current &c) override
 
void setSegmentName (const std::string &segmentName, const ::Ice::Current &c=Ice::emptyCurrent) override
 
void updateEntityThreadUnsafe (const std::string &entityId, const EntityBasePtr &update, const Ice::StringSeq &deactivatedFusionMethods)
 
- Protected Member Functions inherited from SegmentUtilImplementations
void keepAliveCheck ()
 
- Protected Attributes inherited from WorkingMemoryEntitySegment< ObjectClass >
IdEntityMap entityMap
 
EntityFusionMethodPtr fusionMethod
 
int lastEntityId
 
MemoryInterfacePtr parentMemory
 
std::string segmentName
 
- Protected Attributes inherited from SegmentUtilImplementations
armarx::PeriodicTask< SegmentUtilImplementations >::pointer_type keepAliveCheckTask
 
IceUtil::Time keepAliveTimestamp
 
std::mutex keepAliveTimestampMutex
 
std::string lockToken
 
std::mutex mutex
 
ScopedSharedLockPtr readLock
 
std::shared_mutex segmentMutex
 
EntityMemorySegmentInterfacePrx selfProxy
 
std::mutex tokenMutex
 
ScopedUniqueLockPtr writeLock
 

Detailed Description

The object class segment is a specialized segment of the SegmentedMemory.

It keeps object classes which are usually held in short term memory. This segment is usually part of the working memory.

Definition at line 43 of file ObjectClassMemorySegment.h.

Constructor & Destructor Documentation

◆ ObjectClassMemorySegment()

ObjectClassMemorySegment ( const PriorKnowledgeInterfacePrx &  priorKnowledgePrx)
inline

Creates a new object class segment.

Object classes are usually fetched from prior knowledge. Use the method addPriorClassWithSubclasses() in order to fetch parts of the class ontology into the object classes segment. Object classes in this segment use reference counting so use the methods provided in this class to add, update and remove classes. The ObjectClass MongoDB-collections that are accessed can be configured via PriorKnowledge config files (e.g. Prior_Objects)

Parameters
priorKnowledgePrxproxy to prior knowledge

Definition at line 59 of file ObjectClassMemorySegment.h.

Member Function Documentation

◆ addPriorClassWithSubclasses()

ObjectClassList addPriorClassWithSubclasses ( const std::string &  className,
const ::Ice::Current &  = Ice::emptyCurrent 
)
inlineoverride

Fetches a class and its ontological subclasses from prior knowledge and inserts the complete subtree in this segment.

If a class with the same name already exists in this segment, its reference count is increased.

Parameters
classNamename of the class in prior knowledge

Definition at line 76 of file ObjectClassMemorySegment.h.

◆ getClassWithSubclasses()

ObjectClassList getClassWithSubclasses ( const std::string &  rootClassName,
const ::Ice::Current &  = Ice::emptyCurrent 
)
inlineoverride

Retrieves complete ontological tree from this segment.

Parameters
rootClassNamename of the root class

Definition at line 103 of file ObjectClassMemorySegment.h.

◆ ListContainsObject()

static bool ListContainsObject ( const ObjectClassList &  objects,
ObjectClassBasePtr  object 
)
inlinestatic

Definition at line 239 of file ObjectClassMemorySegment.h.

+ Here is the caller graph for this function:

◆ ObjectsToString()

static std::string ObjectsToString ( const ObjectClassList &  objects)
inlinestatic

Definition at line 197 of file ObjectClassMemorySegment.h.

+ Here is the caller graph for this function:

◆ ObjectsToStringList()

static Ice::StringSeq ObjectsToStringList ( const ObjectClassList &  objects)
inlinestatic

Definition at line 220 of file ObjectClassMemorySegment.h.

+ Here is the caller graph for this function:

◆ removePriorClassWithSubclasses()

void removePriorClassWithSubclasses ( const std::string &  className,
const ::Ice::Current &  = Ice::emptyCurrent 
)
inlineoverride

Removes a class and its ontological subclasses.

The ontology is fetched from prior knowledge.

Reference counting is used, so classes are only removed, if they are not referenced anymore.

Parameters
classNamename of the class in prior knowledge

Definition at line 182 of file ObjectClassMemorySegment.h.

◆ updateClass()

ObjectClassBasePtr updateClass ( const std::string &  className,
const ObjectClassBasePtr &  update,
const ::Ice::Current &  = Ice::emptyCurrent 
)
inlineoverride

Update a class with the given entity.

Copys reference counter to updated entity.

Parameters
classNamename of the class in prior knowledge
updateentity replacing the old one

Definition at line 142 of file ObjectClassMemorySegment.h.

+ Here is the call graph for this function:

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