Go to the documentation of this file.
26 workingMemory(workingMemory), longtermMemory(longtermMemory)
37 data::AddSegmentResult
43 data::AddSegmentResult output;
58 output.success =
false;
59 output.errorMessage = e.what();
65 if (
input.providerSegmentName.size() > 0)
68 [&coreSegment, &
input]()
77 if (
input.clearWhenExists)
79 server::wm::ProviderSegment& provider =
80 coreSegment->getProviderSegment(input.providerSegmentName);
92 output.success =
true;
93 output.segmentID = segmentID.
str();
97 data::AddSegmentsResult
103 data::AddSegmentsResult output;
104 for (
const auto& i :
input)
106 output.push_back(
addSegment(i, addCoreSegments));
116 auto handleException = [](
const std::string& what)
118 data::CommitResult result;
119 data::EntityUpdateResult& r = result.results.emplace_back();
121 r.errorMessage = what;
133 return handleException(e.what());
135 catch (
const Ice::Exception& e)
138 return handleException(e.what());
142 data::CommitResult resultIce;
143 toIce(resultIce, result);
159 return this->_commit(
commit,
false);
167 auto handleException = [](
const std::string& what)
169 data::CommitResult result;
170 data::EntityUpdateResult& r = result.results.emplace_back();
172 r.errorMessage = what;
184 return handleException(e.what());
186 catch (
const Ice::Exception& e)
189 return handleException(e.what());
193 data::CommitResult resultIce;
194 toIce(resultIce, result);
210 return this->_commit(
commit,
true);
214 MemoryToIceAdapter::_commit(
const armem::Commit& commit,
bool locking)
217 std::vector<data::MemoryID> updatedIDs;
233 for (
const auto& snapshot : updateResult.removedSnapshots)
235 ARMARX_DEBUG <<
"The id " << snapshot.id() <<
" was removed from wm";
257 catch (
const error::ArMemError& e)
262 catch (
const aron::error::AronException& e)
267 catch (
const Ice::Exception& e)
287 armem::query::data::Result
299 armem::query::data::Result result;
335 result.memory = armarx::toIce<data::MemoryPtr>(wmResult);
337 result.success =
true;
338 if (result.memory->coreSegments.size() == 0)
353 armem::structure::data::GetServerStructureResult
360 armem::structure::data::GetServerStructureResult
ret;
370 if (query_result.success)
372 structure.
append(query_result.memory);
378 ret.serverStructure = armarx::toIce<data::MemoryPtr>(structure);
386 dto::DirectlyStoreResult
392 dto::DirectlyStoreResult output;
393 output.success =
true;
395 armem::wm::Memory m = armarx::fromIce<armem::wm::Memory>(directlStoreInput.memory);
401 dto::StartRecordResult
409 dto::StartRecordResult
ret;
415 dto::StopRecordResult
424 std::thread stopRecordingThread([<m](){
425 ltm->stopRecording();
427 std::thread savingDataUpdateThread([<m](){
428 ltm->bufferFinished();
430 stopRecordingThread.detach();
431 savingDataUpdateThread.detach();
434 <<
"Stopped all LTM recordings, please wait with stopping the component until "
435 "all files are written";
437 dto::StopRecordResult
ret;
443 dto::RecordStatusResult
446 dto::RecordStatusResult
ret;
452 [&savedSnapshots, &totalSnapshots](
const auto&
c)
454 c.forEachProviderSegment(
455 [&savedSnapshots, &totalSnapshots](
const auto& p)
458 [&savedSnapshots, &totalSnapshots](
const auto& e)
460 savedSnapshots += e.getStatistics().recordedSnapshots;
462 e.forEachSnapshot([&totalSnapshots](
const auto&)
463 { totalSnapshots++; });
468 ret.status.savedSnapshots = savedSnapshots;
469 ret.status.totalSnapshots = totalSnapshots;
475 prediction::data::PredictionResultSeq
480 return armarx::toIce<prediction::data::PredictionResultSeq>(res);
483 prediction::data::EngineSupportMap
486 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.
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)
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)
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)
ReaderT::InputType & input
Client-side working memory.
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)
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)
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