26 #include "../../libraries/longtermmemory/WorkingMemorySnapshotListSegment.h"
27 #include "../../libraries/memorytypes/segment/PersistentObjectInstanceSegment.h"
28 #include "../../libraries/memorytypes/segment/KBMSegment.h"
29 #include "../../libraries/memorytypes/segment/OacMemorySegment.h"
30 #include "../../libraries/memorytypes/segment/PersistentProfilerDataSegment.h"
31 #include "../../libraries/memorytypes/segment/PersistentResourceProfileSegment.h"
32 #include "../../libraries/memorytypes/segment/PersistentPredictionDataSegment.h"
33 #include "../../libraries/memorytypes/segment/PersistentObjectClassSegment.h"
34 #include "../../libraries/memorytypes/segment/PersistentDMPDataSegment.h"
36 #include <MemoryX/interface/core/EntityBase.h>
37 #include <MemoryX/interface/memorytypes/MemoryEntities.h>
45 return "LongtermMemory";
52 const std::string clsCollNamesStr = getProperty<std::string>(
"ClassCollections").getValue();
60 priorKnowledgePrx = getProxy<PriorKnowledgeInterfacePrx>(
"PriorKnowledge");
61 const std::string snaplistCollectionName = getProperty<std::string>(
"SnapshotListCollection").getValue();
62 const std::string oacCollectionName = getProperty<std::string>(
"OacCollection").getValue();
63 const std::string kbmCollectionName = getProperty<std::string>(
"KbmCollection").getValue();
64 const std::string dmpCollectionName = getProperty<std::string>(
"DmpCollection").getValue();
65 const std::string profilerCollectionName = getProperty<std::string>(
"ProfilerDataCollection").getValue();
66 const std::string resourceProfileCollectionName = getProperty<std::string>(
"ResourceProfileCollection").getValue();
67 const std::string predictionDataCollectionName = getProperty<std::string>(
"PredictionDataCollection").getValue();
68 const std::string selfLocalisationCollectionName = getProperty<std::string>(
"SelfLocalisationCollection").getValue();
72 CollectionInterfacePrx snapshotListCollection = databaseInterfacePrx->requestCollection(snaplistCollectionName);
73 CollectionInterfacePrx oacCollection = databaseInterfacePrx->requestCollection(oacCollectionName);
74 CollectionInterfacePrx kbmCollection = databaseInterfacePrx->requestCollection(kbmCollectionName);
75 CollectionInterfacePrx dmpCollection = databaseInterfacePrx->requestCollection(dmpCollectionName);
78 addSegment(LTM::SegmentNames::SNAPSHOTS, snapshotListSegment);
81 addSegment(LTM::SegmentNames::OACS, oacSegment);
83 PersistentEntitySegmentBasePtr kbmSegment =
new KBMSegment(kbmCollection,
ic);
84 addSegment(LTM::SegmentNames::KBM, kbmSegment);
86 CollectionInterfacePrx profilerCollection = databaseInterfacePrx->requestCollection(profilerCollectionName);
89 CollectionInterfacePrx resourceProfileCollection = databaseInterfacePrx->requestCollection(resourceProfileCollectionName);
92 CollectionInterfacePrx predictionDataCollection = databaseInterfacePrx->requestCollection(predictionDataCollectionName);
95 CollectionInterfacePrx classColl =
storagePrx->requestCollection(classCollNames[0]);
97 addSegment(LTM::SegmentNames::OBJECTCLASSES, classesSegment);
100 addSegment(LTM::SegmentNames::DMP, dmpSegment);
102 CollectionInterfacePrx selfLocalisationCollection = databaseInterfacePrx->requestCollection(selfLocalisationCollectionName);
104 addSegment(LTM::SegmentNames::SELF_LOCALISATION, selfLocalisationSegment);
106 ARMARX_INFO <<
"successfully connected long term memory";
112 return WorkingMemorySnapshotListSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::SNAPSHOTS,
c));
120 return PersistentObjectInstanceSegmentBasePrx::uncheckedCast(
getSegment(segmentName,
c));
122 else if (createIfMissing)
125 return PersistentObjectInstanceSegmentBasePrx::uncheckedCast(
addSegment(segmentName, customSegment,
c));
129 return PersistentObjectInstanceSegmentBasePrx();
138 if (snapshotListSegment)
140 snapshotListSegment->loadSnapshot(snapshotName, workingMemory);
149 if (snapshotListSegment)
151 return snapshotListSegment->createSnapshot(snapshotName, workingMemory);
164 if (snapshotListSegment)
166 return snapshotListSegment->openSnapshot(snapshotName);
170 return WorkingMemorySnapshotInterfacePrx();
179 if (snapshotListSegment)
181 return snapshotListSegment->removeSnapshot(snapshotName);
194 if (snapshotListSegment)
196 return snapshotListSegment->getSnapshotNames();
200 throw SnapshotNotFoundException(
"Snapshot segment not found!",
"");
213 return PersistentProfilerDataSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::PROFILER,
c));
218 return PersistentPredictionDataSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::PREDICTION_DATA,
c));
224 return PersistentResourceProfileSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::RESOURCE_PROFILES,
c));
230 return OacMemorySegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::OACS,
c));
236 return KBMSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::KBM,
c));
248 return PersistentObjectClassSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::OBJECTCLASSES,
c));
254 return PersistentDMPDataSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::DMP,
c));
260 return PersistentEntitySegmentBasePrx::uncheckedCast(getSegment(LTM::SegmentNames::SELF_LOCALISATION,
c));
267 return addSegment(segmentName, segment);