37#include <MemoryX/interface/core/EntityBase.h>
38#include <MemoryX/interface/memorytypes/MemoryEntities.h>
45 return "LongtermMemory";
62 const std::string snaplistCollectionName =
67 const std::string profilerCollectionName =
69 const std::string resourceProfileCollectionName =
71 const std::string predictionDataCollectionName =
73 const std::string selfLocalisationCollectionName =
78 CollectionInterfacePrx snapshotListCollection =
79 databaseInterfacePrx->requestCollection(snaplistCollectionName);
80 CollectionInterfacePrx oacCollection =
81 databaseInterfacePrx->requestCollection(oacCollectionName);
82 CollectionInterfacePrx kbmCollection =
83 databaseInterfacePrx->requestCollection(kbmCollectionName);
84 CollectionInterfacePrx dmpCollection =
85 databaseInterfacePrx->requestCollection(dmpCollectionName);
89 addSegment(LTM::SegmentNames::SNAPSHOTS, snapshotListSegment);
93 addSegment(LTM::SegmentNames::OACS, oacSegment);
95 PersistentEntitySegmentBasePtr kbmSegment =
new KBMSegment(kbmCollection,
ic);
96 addSegment(LTM::SegmentNames::KBM, kbmSegment);
98 CollectionInterfacePrx profilerCollection =
99 databaseInterfacePrx->requestCollection(profilerCollectionName);
103 CollectionInterfacePrx resourceProfileCollection =
104 databaseInterfacePrx->requestCollection(resourceProfileCollectionName);
105 addSegment(LTM::SegmentNames::RESOURCE_PROFILES,
108 CollectionInterfacePrx predictionDataCollection =
109 databaseInterfacePrx->requestCollection(predictionDataCollectionName);
110 addSegment(LTM::SegmentNames::PREDICTION_DATA,
113 CollectionInterfacePrx classColl =
storagePrx->requestCollection(classCollNames[0]);
116 addSegment(LTM::SegmentNames::OBJECTCLASSES, classesSegment);
119 addSegment(LTM::SegmentNames::DMP, dmpSegment);
121 CollectionInterfacePrx selfLocalisationCollection =
122 databaseInterfacePrx->requestCollection(selfLocalisationCollectionName);
125 addSegment(LTM::SegmentNames::SELF_LOCALISATION, selfLocalisationSegment);
127 ARMARX_INFO <<
"successfully connected long term memory";
130 WorkingMemorySnapshotListSegmentBasePrx
133 return WorkingMemorySnapshotListSegmentBasePrx::uncheckedCast(
137 PersistentObjectInstanceSegmentBasePrx
139 bool createIfMissing,
140 const ::Ice::Current&
c)
144 return PersistentObjectInstanceSegmentBasePrx::uncheckedCast(
147 else if (createIfMissing)
150 databaseInterfacePrx->requestCollection(segmentName),
ic);
151 return PersistentObjectInstanceSegmentBasePrx::uncheckedCast(
156 return PersistentObjectInstanceSegmentBasePrx();
162 const std::string& snapshotName,
163 const AbstractWorkingMemoryInterfacePrx& workingMemory,
164 const ::Ice::Current&)
166 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
169 if (snapshotListSegment)
171 snapshotListSegment->loadSnapshot(snapshotName, workingMemory);
177 const std::string& snapshotName,
178 const AbstractWorkingMemoryInterfacePrx& workingMemory,
179 const ::Ice::Current&)
181 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
184 if (snapshotListSegment)
186 return snapshotListSegment->createSnapshot(snapshotName, workingMemory);
194 WorkingMemorySnapshotInterfacePrx
196 const ::Ice::Current&)
198 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
201 if (snapshotListSegment)
203 return snapshotListSegment->openSnapshot(snapshotName);
207 return WorkingMemorySnapshotInterfacePrx();
213 const ::Ice::Current&)
215 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
218 if (snapshotListSegment)
220 return snapshotListSegment->removeSnapshot(snapshotName);
231 WorkingMemorySnapshotListSegmentBasePrx snapshotListSegment =
234 if (snapshotListSegment)
236 return snapshotListSegment->getSnapshotNames();
240 throw SnapshotNotFoundException(
"Snapshot segment not found!",
"");
250 PersistentProfilerDataSegmentBasePrx
253 return PersistentProfilerDataSegmentBasePrx::uncheckedCast(
257 PersistentPredictionDataSegmentBasePrx
260 return PersistentPredictionDataSegmentBasePrx::uncheckedCast(
261 getSegment(LTM::SegmentNames::PREDICTION_DATA,
c));
264 PersistentResourceProfileSegmentBasePrx
267 return PersistentResourceProfileSegmentBasePrx::uncheckedCast(
268 getSegment(LTM::SegmentNames::RESOURCE_PROFILES,
c));
271 OacMemorySegmentBasePrx
274 return OacMemorySegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::OACS,
c));
280 return KBMSegmentBasePrx::uncheckedCast(
getSegment(LTM::SegmentNames::KBM,
c));
283 CommonStorageInterfacePrx
289 PersistentObjectClassSegmentBasePrx
292 return PersistentObjectClassSegmentBasePrx::uncheckedCast(
296 PersistentDMPDataSegmentBasePrx
299 return PersistentDMPDataSegmentBasePrx::uncheckedCast(
303 PersistentEntitySegmentBasePrx
306 return PersistentEntitySegmentBasePrx::uncheckedCast(
307 getSegment(LTM::SegmentNames::SELF_LOCALISATION,
c));
310 AbstractMemorySegmentPrx
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
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
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