Go to the documentation of this file.
29 workingMemory(workingMemory), longtermMemory(longtermMemory)
40 data::AddSegmentResult
46 data::AddSegmentResult output;
61 output.success =
false;
62 output.errorMessage = e.what();
68 if (
input.providerSegmentName.size() > 0)
71 [&coreSegment, &
input]()
80 if (
input.clearWhenExists)
82 server::wm::ProviderSegment& provider =
83 coreSegment->getProviderSegment(input.providerSegmentName);
95 output.success =
true;
96 output.segmentID = segmentID.
str();
100 data::AddSegmentsResult
106 data::AddSegmentsResult output;
107 for (
const auto& i :
input)
109 output.push_back(
addSegment(i, addCoreSegments));
119 auto handleException = [](
const std::string& what)
121 data::CommitResult result;
122 data::EntityUpdateResult& r = result.results.emplace_back();
124 r.errorMessage = what;
136 return handleException(e.what());
138 catch (
const Ice::Exception& e)
141 return handleException(e.what());
145 data::CommitResult resultIce;
146 toIce(resultIce, result);
162 return this->_commit(
commit,
false);
170 auto handleException = [](
const std::string& what)
172 data::CommitResult result;
173 data::EntityUpdateResult& r = result.results.emplace_back();
175 r.errorMessage = what;
187 return handleException(e.what());
189 catch (
const Ice::Exception& e)
192 return handleException(e.what());
196 data::CommitResult resultIce;
197 toIce(resultIce, result);
213 return this->_commit(
commit,
true);
217 MemoryToIceAdapter::_commit(
const armem::Commit& commit,
bool locking)
220 std::vector<data::MemoryID> updatedIDs;
236 for (
const auto& snapshot : updateResult.removedSnapshots)
238 ARMARX_DEBUG <<
"The id " << snapshot.id() <<
" was removed from wm";
260 catch (
const error::ArMemError& e)
265 catch (
const aron::error::AronException& e)
270 catch (
const Ice::Exception& e)
290 armem::query::data::Result
302 armem::query::data::Result result;
338 result.memory = armarx::toIce<data::MemoryPtr>(wmResult);
340 result.success =
true;
341 if (result.memory->coreSegments.size() == 0)
356 armem::structure::data::GetServerStructureResult
363 armem::structure::data::GetServerStructureResult
ret;
373 if (query_result.success)
375 structure.
append(query_result.memory);
381 ret.serverStructure = armarx::toIce<data::MemoryPtr>(structure);
391 ARMARX_INFO <<
"Reloading of data from LTM into WM triggered";
395 std::list<std::string>
names;
396 std::stringstream ss(coreNames);
399 while (std::getline(ss, item,
',')) {
400 names.push_back(item);
409 auto res = this->
commit(com);
422 dto::DirectlyStoreResult
428 dto::DirectlyStoreResult output;
429 output.success =
true;
431 armem::wm::Memory m = armarx::fromIce<armem::wm::Memory>(directlStoreInput.memory);
437 dto::StartRecordResult
445 dto::StartRecordResult
ret;
451 dto::StopRecordResult
460 std::thread stopRecordingThread([<m](){
461 ltm->stopRecording();
463 std::thread savingDataUpdateThread([<m](){
464 ltm->bufferFinished();
466 stopRecordingThread.detach();
467 savingDataUpdateThread.detach();
470 <<
"Stopped all LTM recordings, please wait with stopping the component until "
471 "all files are written";
473 dto::StopRecordResult
ret;
479 dto::RecordStatusResult
482 dto::RecordStatusResult
ret;
488 [&savedSnapshots, &totalSnapshots](
const auto&
c)
490 c.forEachProviderSegment(
491 [&savedSnapshots, &totalSnapshots](
const auto& p)
494 [&savedSnapshots, &totalSnapshots](
const auto& e)
496 savedSnapshots += e.getStatistics().recordedSnapshots;
498 e.forEachSnapshot([&totalSnapshots](
const auto&)
499 { totalSnapshots++; });
504 ret.status.savedSnapshots = savedSnapshots;
505 ret.status.totalSnapshots = totalSnapshots;
511 prediction::data::PredictionResultSeq
516 return armarx::toIce<prediction::data::PredictionResultSeq>(res);
519 prediction::data::EngineSupportMap
522 prediction::data::EngineSupportMap result;
server::wm::Memory * workingMemory
ReaderT::InputType T & ret
std::string providerSegmentName
A bundle of updates to be sent to the memory.
QueryInput buildQueryInput() const
Result of an EntityUpdate.
std::string coreSegmentsToLoad
server::ltm::Memory * longtermMemory
CoreSegmentT & getCoreSegment(const std::string &name)
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
dto::StartRecordResult startRecord(const dto::StartRecordInput &startRecordInput)
client::MemoryListenerInterfacePrx memoryListenerTopic
std::string str(bool escapeDelimiters=true) const
Get a string representation of this memory ID.
void toMemory(Memory &m, const std::vector< CoreSegment > &e)
void toIce(data::MemoryID &ice, const MemoryID &id)
DataMode boolToDataMode(bool withData)
struct armarx::armem::server::ltm::detail::MemoryBase::Properties p
std::string coreSegmentName
prediction::data::PredictionResultSeq predict(prediction::data::PredictionRequestSeq requests)
armem::structure::data::GetServerStructureResult getServerStructure()
A memory storing data on the hard drive and in mongodb (needs 'armarx memory start' to start the mong...
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
armem::CommitResult reloadFromLTM()
void setMemoryListener(client::MemoryListenerInterfacePrx memoryListenerTopic)
ResultMemoryT process(const armem::query::data::Input &input, const MemoryT &memory) const
std::map< MemoryID, std::vector< PredictionEngine > > getAllPredictionEngines() const
void fromIce(Eigen::Vector2f &e, const Ice::FloatSeq &ice)
armem::wm::Memory loadLatestNReferences(int n)
ReaderT::InputType & input
Client-side working memory.
int maxAmountOfSnapshotsLoaded
The AronNotValidException class.
An update of an entity for a specific point in time.
CoreSegmentT & addCoreSegment(const std::string &name, aron::type::ObjectPtr coreSegmentType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
Add an empty core segment with the given name, type and prediction engines.
bool forEachCoreSegment(std::function< void(CoreSegment &)> func) const final
iterate over all core segments of this ltm
dto::RecordStatusResult getRecordStatus()
auto doLocked(FunctionT &&function) const
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
void startRecording()
enable/disable
prediction::data::EngineSupportMap getAvailableEngines()
dto::StopRecordResult stopRecord()
void fromIce(const std::map< IceKeyT, IceValueT > &iceMap, boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
dto::DirectlyStoreResult directlyStore(const dto::DirectlyStoreInput &directlStoreInput)
Represents a point in time.
data::AddSegmentResult addSegment(const data::AddSegmentInput &input, bool addCoreSegments=false)
const simox::meta::IntEnumNames names
armem::wm::Memory loadAllReferences()
return the full ltm as a wm::Memory with only references the ltm may be huge, use with caution
std::vector< EntityUpdateResult > results
data::AddSegmentsResult addSegments(const data::AddSegmentsInput &input, bool addCoreSegments=false)
MemoryToIceAdapter(server::wm::Memory *workingMemory=nullptr, server::ltm::Memory *longtermMemory=nullptr)
Construct an MemoryToIceAdapter from an existing Memory.
@ NoData
Just get the structure, but no ARON data.
void append(const OtherDerivedT &other)
Merge another memory into this one.
The query::Builder class provides a fluent-style specification of hierarchical queries.
std::vector< PredictionResult > dispatchPredictions(const std::vector< PredictionRequest > &requests)
std::vector< UpdateResult > update(const Commit &commit, const bool addMissingCoreSegmentDuringUpdate=false, const bool checkMemoryName=true)
Store all updates in commit.
Indicates that a name in a given ID does not match a container's own name.
void all()
Get all snapshots from all entities in all segments.
ProviderSegment & addProviderSegment(const std::string &name, Args... args)
std::vector< Base::UpdateResult > updateLocking(const Commit &commit)
Perform the commit, locking the core segments.
static QueryResult fromIce(const armem::query::data::Result &ice)
Commit toCommit(const ContainerT &container)
data::CommitResult commitLocking(const data::Commit &commitIce, Time timeArrived)
data::CommitResult commit(const data::Commit &commitIce, Time timeArrived)
Indicates that a container did not have an entry under a given name.
query::data::Result query(const armem::query::data::Input &input)
void store(const armem::wm::Memory &memory)
append a wm::Memory instance to the ltm
void directlyStore(const armem::wm::Memory &memory)
const armem::MemoryID MemoryID