Go to the documentation of this file.
27 const std::string& exportName,
36 const std::string& exportName,
44 ARMARX_INFO <<
"Creating a new memory at " <<
p.string() <<
" and " << exportName;
66 ARMARX_IMPORTANT <<
"Storing of data finished, starting to generate and save statistics...";
96 id().withCoreSegmentName(segmentName),
107 <<
" does not exist.";
143 id().withCoreSegmentName(
name),
146 return c.fullPathExists();
152 std::unique_ptr<CoreSegment>
165 id().withCoreSegmentName(coreSegmentName),
188 x.loadAllReferences(
s);
203 x.loadLatestNReferences(n,
s);
215 [&m, &n, &coreSegNames](
auto& x)
217 bool loadCoreSeg = (std::find(coreSegNames.begin(), coreSegNames.end(), x.id().coreSegmentName) != coreSegNames.end());
220 x.loadLatestNReferences(n,
s);
223 ARMARX_DEBUG <<
"Skipping loading CoreSegment with name "
224 << x.id().coreSegmentName
225 <<
" from LTM into WM as it is not in the defined list";
247 id().withCoreSegmentName(e.id().coreSegmentName),
252 ARMARX_WARNING <<
"You are trying to resolve an LTM from a path that does not exist: "
271 <<
"During storage of memory '" <<
memory.id().str()
272 <<
"' I noticed that the corresponding LTM has no id set. "
273 <<
"I set the id of the LTM to the same name, however this should not happen!";
283 memory.forEachCoreSegment(
284 [&](
const auto& core)
289 id().withCoreSegmentName(core.id().coreSegmentName),
313 auto firstTimeStarted = this->
statistics.firstStarted;
314 if (!firstTimeStarted.isValid())
317 ARMARX_DEBUG <<
"No Statistics will be saved because firstStarted is invalid: "
326 if (first_stats.empty())
329 ARMARX_DEBUG <<
"No Statistics will be saved because no actual data was recorded.";
332 std::map<std::string,
333 std::map<std::string, ltm::processor::SnapshotFilter::FilterStatistics>>
335 std::map<std::string, armarx::core::time::DateTime> times;
341 information[
"LTM"] = first_stats;
345 ARMARX_INFO <<
"Something went wrong after getting the statistics";
351 test::save_statistics(information,
361 ARMARX_INFO <<
"Something went wrong with the statistics saving process";
Statistics getStatistics() const
void setMixinMemoryID(const MemoryID &id)
void _loadAllReferences(armem::wm::Memory &) final
void setMixinMemoryID(const MemoryID &id)
void _setExportName(const std::string &n) final
std::shared_ptr< Processors > processors
void configureMixin(const nlohmann::json &json)
configuration
Path getMemoryBasePath() const
void getAndSaveStatistics()
getAndSaveStatistics generates and saves statistics for a LTM recording
void _directlyStore(const armem::wm::Memory &) final
void createPropertyDefinitions(PropertyDefinitionsPtr &defs, const std::string &prefix)
void createPropertyDefinitions(PropertyDefinitionsPtr &defs, const std::string &prefix) override
default parameters. Implementation should use the configuration to configure
std::string str(bool escapeDelimiters=true) const
Get a string representation of this memory ID.
void setMixinMemoryID(const MemoryID &n)
struct armarx::armem::server::ltm::detail::MemoryBase::Properties p
Brief description of class memory.
void _configure(const nlohmann::json &config) final
configuration
std::string unescapeName(const std::string &escapedName)
void _loadOnStartup() final
bool forEachCoreSegment(CoreSegmentFunctionT &&func)
A memory storing data on the hard drive and in mongodb (needs 'armarx memory start' to start the mong...
void setMixinMemoryID(const armem::MemoryID &)
setter
std::vector< Path > getAllDirectories() const
void _resolve(armem::wm::Memory &) final
void addToBuffer(const armem::wm::Memory &memory)
void setMemoryID(const MemoryID &)
void _setMemoryID(const MemoryID &id) final
std::recursive_mutex ltm_mutex
Client-side working memory core segment.
void configureMixin(const nlohmann::json &json)
configuration
Client-side working memory.
std::string extractLastDirectoryFromPath(const std::string &path)
void setMixinExportName(const std::string &n)
MongoDBSettings getSettings() const
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
virtual void createPropertyDefinitions(PropertyDefinitionsPtr &defs, const std::string &prefix)
default parameters. Implementation should use the configuration to configure
virtual std::string getExportName() const
std::map< std::string, processor::SnapshotFilter::FilterStatistics > getFilterStatistics()
void setMixinExportName(const std::string &n)
MemoryID getMemoryID() const
void configureMixin(const nlohmann::json &json)
configuration
const std::string memoryName
bool fullPathExists() const
bool cacheHasCoreSegment(const std::string &n) const
void _loadLatestNReferences(int n, armem::wm::Memory &m) final
void createPropertyDefinitions(PropertyDefinitionsPtr &defs, const std::string &prefix)
std::filesystem::path Path
std::unique_ptr< CoreSegment > findCoreSegment(const std::string &coreSegmentName) const final
find core segment
void _store(const armem::wm::Memory &) final
bool hasCoreSegment(const std::string &name) const final
check if core segment exists
void configureMixin(const nlohmann::json &json)
double s(double t, double s0, double v0, double a0, double j)