From 8bdf990169020a98e503f22c7355bdaf94c7bd08 Mon Sep 17 00:00:00 2001 From: Fabian Peller-Konrad <fabian.peller-konrad@kit.edu> Date: Tue, 20 Feb 2024 15:42:36 +0100 Subject: [PATCH] allow loading of types and do not copy loaded memory twice --- source/RobotAPI/libraries/armem_gui/MemoryViewer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/RobotAPI/libraries/armem_gui/MemoryViewer.cpp b/source/RobotAPI/libraries/armem_gui/MemoryViewer.cpp index 5cf0df437..bfa97db1e 100644 --- a/source/RobotAPI/libraries/armem_gui/MemoryViewer.cpp +++ b/source/RobotAPI/libraries/armem_gui/MemoryViewer.cpp @@ -442,10 +442,11 @@ namespace armarx::armem::gui { std::string name = memory.id().memoryName; - auto commit = armem::toCommit(memory); - if (memoryWriters.count(name) > 0) { + // we need to merge the current memory with the one from the disk. + // Please note that this may ignores coresegments, if not already existent + auto commit = armem::toCommit(memory); memoryWriters.at(name).commit(commit); } else @@ -456,10 +457,9 @@ namespace armarx::armem::gui // Please note: Here we assume that a memory server with the same name does not exist. // I think this assumption is ok, since nobody should use filepaths as memory name. // Nonetheless, we did not restrict the user to do so... - std::string virtualMemoryName = name + " (at " + path.string() + ")"; - wm::Memory virtualMemory(virtualMemoryName); - virtualMemory.update(commit, true, false); - memoryData[virtualMemoryName] = std::move(virtualMemory); + std::string virtualMemoryName = name;// + " (at " + path.string() + ")"; + memory.id().memoryName = virtualMemoryName; + memoryData[virtualMemoryName] = std::move(memory); } } -- GitLab