25 #include "../MongoSerializer.h"
28 #include <ArmarXCore/interface/serialization/JSONSerialization.h>
31 #include <Ice/ObjectAdapter.h>
41 this->entityName = entityName;
44 EntityRef::EntityRef(EntityBasePtr entity,
const std::string& segmentName,
const std::string&
memoryName, MemoryInterfacePrx memoryPrx, EntityMemorySegmentInterfacePrx segmentPrx)
46 this->entityId = entity->getId();
47 this->entityName = entity->getName();
48 this->memory = memoryPrx;
49 this->segment = segmentPrx;
50 this->segmentName = segmentName;
56 EntityRefBase(entityRef)
58 this->entityId = entityRef.entityId;
59 this->segment = entityRef.segment;
60 this->segmentName = entityRef.segmentName;
61 this->memory = entityRef.memory;
63 this->entityName = entityRef.entityName;
70 obj->setString(
"entityId", entityId);
71 obj->setString(
"entityName", entityName);
72 obj->setString(
"segmentName", this->segmentName);
73 obj->setString(
"memoryName", this->
memoryName);
79 entityId = obj->getString(
"entityId");
80 entityName = obj->getString(
"entityName");
82 segmentName = obj->getString(
"segmentName");
85 if (
c.adapter &&
c.adapter->getCommunicator())
87 memory = MemoryInterfacePrx::checkedCast(
c.adapter->getCommunicator()->stringToProxy(
memoryName));
91 segment = memoryx::EntityMemorySegmentInterfacePrx::checkedCast(memory->getSegment(segmentName));
105 ARMARX_ERROR_S <<
"adapter or communicator zero - cannot create proxy to segment " << segmentName;
116 return this->
clone();
121 return entityName +
"_" + entityId +
" in segment (" + segmentName +
")";
138 return segment->getEntityById(entityId);
150 return entityId == other->entityId && segmentName == other->segmentName &&
memoryName == other->memoryName;