Skip to content
Snippets Groups Projects

Allow loading of LTM exports to the Viewer, although the memory servers have not been started

Merged Fabian Tërnava requested to merge armem_gui/allow_load_inactive_memories_ltm into master
Files
10
@@ -261,12 +261,12 @@ namespace armarx::armem::base
* @param commit The commit.
* @return The resulting memory IDs.
*/
std::vector<UpdateResult> update(const Commit& commit)
std::vector<UpdateResult> update(const Commit& commit, const bool addMissingCoreSegmentDuringUpdate = false, const bool checkMemoryName = true)
{
std::vector<UpdateResult> results;
for (const EntityUpdate& update : commit.updates)
{
results.push_back(this->update(update));
results.push_back(this->update(update, addMissingCoreSegmentDuringUpdate, checkMemoryName));
}
return results;
}
@@ -276,11 +276,14 @@ namespace armarx::armem::base
* @param update The update.
* @return The resulting entity snapshot's ID.
*/
UpdateResult update(const EntityUpdate& update)
UpdateResult update(const EntityUpdate& update, const bool addMissingCoreSegmentDuringUpdate = false, const bool checkMemoryName = true)
{
this->_checkContainerName(update.entityID.memoryName, this->name());
if (checkMemoryName)
{
this->_checkContainerName(update.entityID.memoryName, this->name());
}
auto [inserted, coreSeg] = _addCoreSegmentIfMissing(update.entityID.coreSegmentName);
auto [inserted, coreSeg] = _addCoreSegmentIfMissing(update.entityID.coreSegmentName, addMissingCoreSegmentDuringUpdate);
// Update entry.
UpdateResult ret(coreSeg->update(update));
@@ -349,14 +352,14 @@ namespace armarx::armem::base
protected:
std::pair<bool, CoreSegmentT*> _addCoreSegmentIfMissing(const std::string& coreSegmentName)
std::pair<bool, CoreSegmentT*> _addCoreSegmentIfMissing(const std::string& coreSegmentName, const bool addMissingCoreSegmentDuringUpdate)
{
CoreSegmentT* coreSeg = nullptr;
auto it = this->_container.find(coreSegmentName);
if (it == this->_container.end())
{
if (_addMissingCoreSegmentDuringUpdate)
if (addMissingCoreSegmentDuringUpdate)
{
// Insert into map.
coreSeg = &addCoreSegment(coreSegmentName);
@@ -373,13 +376,5 @@ namespace armarx::armem::base
return {false, coreSeg};
}
}
public:
// ToDo: Remove from base structure - this should be specific to the server versions.
// If necessary at all.
bool _addMissingCoreSegmentDuringUpdate = false;
};
}
Loading