38#include <MemoryX/interface/core/EntityBase.h>
39#include <MemoryX/interface/memorytypes/MemoryEntities.h>
46 return "LongtermMemory";
52 return "LongtermMemory";
69 const std::string snaplistCollectionName =
74 const std::string profilerCollectionName =
76 const std::string resourceProfileCollectionName =
78 const std::string predictionDataCollectionName =
80 const std::string selfLocalisationCollectionName =
85 CollectionInterfacePrx snapshotListCollection =
86 databaseInterfacePrx->requestCollection(snaplistCollectionName);
87 CollectionInterfacePrx oacCollection =
88 databaseInterfacePrx->requestCollection(oacCollectionName);
89 CollectionInterfacePrx kbmCollection =
90 databaseInterfacePrx->requestCollection(kbmCollectionName);
91 CollectionInterfacePrx dmpCollection =
92 databaseInterfacePrx->requestCollection(dmpCollectionName);
96 addSegment(LTM::SegmentNames::SNAPSHOTS, snapshotListSegment);
100 addSegment(LTM::SegmentNames::OACS, oacSegment);
102 PersistentEntitySegmentBasePtr kbmSegment =
new KBMSegment(kbmCollection,
ic);
103 addSegment(LTM::SegmentNames::KBM, kbmSegment);
105 CollectionInterfacePrx profilerCollection =
106 databaseInterfacePrx->requestCollection(profilerCollectionName);
110 CollectionInterfacePrx resourceProfileCollection =
111 databaseInterfacePrx->requestCollection(resourceProfileCollectionName);
112 addSegment(LTM::SegmentNames::RESOURCE_PROFILES,
115 CollectionInterfacePrx predictionDataCollection =
116 databaseInterfacePrx->requestCollection(predictionDataCollectionName);
117 addSegment(LTM::SegmentNames::PREDICTION_DATA,
120 CollectionInterfacePrx classColl =
storagePrx->requestCollection(classCollNames[0]);
123 addSegment(LTM::SegmentNames::OBJECTCLASSES, classesSegment);
126 addSegment(LTM::SegmentNames::DMP, dmpSegment);
128 CollectionInterfacePrx selfLocalisationCollection =
129 databaseInterfacePrx->requestCollection(selfLocalisationCollectionName);
132 addSegment(LTM::SegmentNames::SELF_LOCALISATION, selfLocalisationSegment);
134 ARMARX_INFO <<
"successfully connected long term memory";
137 WorkingMemorySnapshotListSegmentBasePrx
140 return WorkingMemorySnapshotListSegmentBasePrx::uncheckedCast(
144 PersistentObjectInstanceSegmentBasePrx
146 bool createIfMissing,
147 const ::Ice::Current&
c)
151 return PersistentObjectInstanceSegmentBasePrx::uncheckedCast(
154 else if (createIfMissing)
157 databaseInterfacePrx->requestCollection(segmentName),
ic);
158 return PersistentObjectInstanceSegmentBasePrx::uncheckedCast(
163 return PersistentObjectInstanceSegmentBasePrx();
169 const std::string& snapshotName,
170 const AbstractWorkingMemoryInterfacePrx& workingMemory,
171 const ::Ice::Current&)
173 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
176 if (snapshotListSegment)
178 snapshotListSegment->loadSnapshot(snapshotName, workingMemory);
184 const std::string& snapshotName,
185 const AbstractWorkingMemoryInterfacePrx& workingMemory,
186 const ::Ice::Current&)
188 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
191 if (snapshotListSegment)
193 return snapshotListSegment->createSnapshot(snapshotName, workingMemory);
201 WorkingMemorySnapshotInterfacePrx
203 const ::Ice::Current&)
205 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
208 if (snapshotListSegment)
210 return snapshotListSegment->openSnapshot(snapshotName);
214 return WorkingMemorySnapshotInterfacePrx();
220 const ::Ice::Current&)
222 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
225 if (snapshotListSegment)
227 return snapshotListSegment->removeSnapshot(snapshotName);
238 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
241 if (snapshotListSegment)
243 return snapshotListSegment->getSnapshotNames();
247 throw SnapshotNotFoundException(
"Snapshot segment not found!",
"");
257 PersistentProfilerDataSegmentBasePrx
260 return PersistentProfilerDataSegmentBasePrx::uncheckedCast(
264 PersistentPredictionDataSegmentBasePrx
267 return PersistentPredictionDataSegmentBasePrx::uncheckedCast(
268 getSegment(LTM::SegmentNames::PREDICTION_DATA,
c));
271 PersistentResourceProfileSegmentBasePrx
274 return PersistentResourceProfileSegmentBasePrx::uncheckedCast(
275 getSegment(LTM::SegmentNames::RESOURCE_PROFILES,
c));
278 OacMemorySegmentBasePrx
281 return OacMemorySegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::OACS,
c));
287 return KBMSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::KBM,
c));
290 CommonStorageInterfacePrx
296 PersistentObjectClassSegmentBasePrx
299 return PersistentObjectClassSegmentBasePrx::uncheckedCast(
303 PersistentDMPDataSegmentBasePrx
306 return PersistentDMPDataSegmentBasePrx::uncheckedCast(
310 PersistentEntitySegmentBasePrx
313 return PersistentEntitySegmentBasePrx::uncheckedCast(
314 getSegment(LTM::SegmentNames::SELF_LOCALISATION,
c));
317 AbstractMemorySegmentPrx
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
Property< PropertyType > getProperty(const std::string &name)
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
std::string getName() const
Retrieve name of object.
IceManagerPtr getIceManager() const
Returns the IceManager.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
Ice::CommunicatorPtr getCommunicator() const
CommonStorageInterfacePrx storagePrx
The LongtermMemory class provides persistent data that has been learned or copied as a snapshot from ...
NameList getSnapshotNames(const ::Ice::Current &=Ice::emptyCurrent) override
PersistentObjectInstanceSegmentBasePrx getCustomInstancesSegment(const std::string &segmentName, bool createIfMissing, const ::Ice::Current &c=Ice::emptyCurrent) override
void loadWorkingMemorySnapshot(const std::string &snapshotName, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
AbstractMemorySegmentPrx addGenericSegment(const std::string &segmentName, const Ice::Current &) override
OacMemorySegmentBasePrx getOacSegment(const ::Ice::Current &=Ice::emptyCurrent) override
bool removeWorkingMemorySnapshot(const std::string &snapshotName, const ::Ice::Current &=Ice::emptyCurrent) override
bool saveWorkingMemorySnapshot(const std::string &snapshotName, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
CommonStorageInterfacePrx getCommonStorage(const ::Ice::Current &c=Ice::emptyCurrent) const override
PersistentProfilerDataSegmentBasePrx getProfilerDataSegment(const Ice::Current &c=Ice::emptyCurrent) override
KBMSegmentBasePrx getKBMSegment(const Ice::Current &) override
void onConnectLongtermMemory() override
PersistentDMPDataSegmentBasePrx getDMPSegment(const ::Ice::Current &=Ice::emptyCurrent) override
std::string getMemoryName(const Ice::Current &=Ice::emptyCurrent) const override
PersistentEntitySegmentBasePrx getSelfLocalisationSegment(const Ice::Current &c=Ice::emptyCurrent) override
PersistentResourceProfileSegmentBasePrx getResourceProfileSegment(const Ice::Current &c=Ice::emptyCurrent) override
static std::string GetDefaultName()
WorkingMemorySnapshotListSegmentBasePrx getWorkingMemorySnapshotListSegment(const ::Ice::Current &=Ice::emptyCurrent) override
void onInitLongtermMemory() override
PersistentPredictionDataSegmentBasePrx getPredictionDataSegment(const Ice::Current &c=Ice::emptyCurrent) override
PersistentObjectClassSegmentBasePrx getObjectClassesSegment(const ::Ice::Current &c=Ice::emptyCurrent) const override
WorkingMemorySnapshotInterfacePrx openWorkingMemorySnapshot(const std::string &snapshotName, const ::Ice::Current &=Ice::emptyCurrent) override
std::string getDefaultName() const override
Retrieve default name of component.
The PersistentEntitySegment class is the base class for all memory segments containing memoryx::Entit...
The persistent object class segment is a specialized segment of the SegmentedMemory.
AbstractMemorySegmentPrx addSegment(const std::string &segmentName, const AbstractMemorySegmentPtr &segment, const ::Ice::Current &=Ice::emptyCurrent) override
AbstractMemorySegmentPrx getSegment(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) const override
bool hasSegment(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) const override
#define ARMARX_INFO
The normal logging level.
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
IceInternal::Handle< PersistentObjectInstanceSegment > PersistentObjectInstanceSegmentPtr
IceUtil::Handle< PersistentEntitySegment > PersistentEntitySegmentPtr
IceInternal::Handle< PersistentObjectClassSegment > PersistentObjectClassSegmentPtr
IceInternal::Handle< PersistentDMPDataSegment > PersistentDMPDataSegmentPtr
IceUtil::Handle< WorkingMemorySnapshotListSegment > WorkingMemorySnapshotListSegmentPtr
IceInternal::Handle< OacMemorySegment > OacMemorySegmentPtr