Skip to content
Snippets Groups Projects
Commit c815180a authored by Fabian Tërnava's avatar Fabian Tërnava
Browse files

update argument type of ltm control widget methods. The key brings no value so...

update argument type of ltm control widget methods. The key brings no value so passing a vector is enough
parent de219014
No related branches found
No related tags found
1 merge request!326Allow loading of LTM exports to the Viewer, although the memory servers have not been started
......@@ -406,7 +406,11 @@ namespace armarx::armem::gui
TIMING_START(MemoryExport)
std::string status;
diskControl->storeOnDisk(directory, memoryData, &status);
std::vector<wm::Memory> memoryDataVec;
std::transform(memoryData.begin(), memoryData.end(), std::back_inserter(memoryDataVec),
[](auto& el) { return el.second; });
diskControl->storeOnDisk(directory, memoryDataVec, &status);
statusLabel->setText(QString::fromStdString(status));
TIMING_END_STREAM(MemoryExport, ARMARX_VERBOSE)
......@@ -418,11 +422,13 @@ namespace armarx::armem::gui
{
std::string status;
std::map<std::string, wm::Memory> data =
std::map<std::filesystem::path, wm::Memory> data =
diskControl->loadFromDisk(directory, memoryGroup->queryInput(), &status);
for (auto& [name, memory] : data)
for (auto& [path, memory] : data)
{
std::string name = memory.id().memoryName;
if (memoryWriters.count(name) > 0)
{
auto commit = armem::toCommit(memory);
......
......@@ -78,7 +78,7 @@ namespace armarx::armem::gui::disk
void
ControlWidget::storeOnDisk(
QString directory,
const std::map<std::string, wm::Memory> memoryData,
const std::vector<wm::Memory> memoryData,
std::string* outStatus)
{
std::filesystem::path path(directory.toUtf8().constData());
......@@ -92,8 +92,9 @@ namespace armarx::armem::gui::disk
else
{
int numStored = 0;
for (const auto& [name, data] : memoryData)
for (const auto& data : memoryData)
{
std::string name = data.id().memoryName;
if (std::filesystem::is_regular_file(path / name))
{
status << "Could not export memory '" << name << "' to " << path << ": Cannot overwrite existing file.\n";
......@@ -116,7 +117,7 @@ namespace armarx::armem::gui::disk
}
std::map<std::string, wm::Memory>
std::map<std::filesystem::path, wm::Memory>
ControlWidget::loadFromDisk(
QString directory,
const armem::client::QueryInput& _queryInput,
......@@ -124,7 +125,7 @@ namespace armarx::armem::gui::disk
{
std::filesystem::path path(directory.toUtf8().constData());
std::map<std::string, wm::Memory> memoryData;
std::map<std::filesystem::path, wm::Memory> memoryData;
auto setStatus = [&](const std::string& s){
if (outStatus)
......
......@@ -5,6 +5,7 @@
#include <QWidget>
#include <QString>
#include <filesystem>
class QPushButton;
......@@ -26,10 +27,10 @@ namespace armarx::armem::gui::disk
void
storeOnDisk(
QString directory,
const std::map<std::string, wm::Memory> memoryData,
const std::vector<wm::Memory> memoryData,
std::string* outStatus = nullptr);
std::map<std::string, wm::Memory>
std::map<std::filesystem::path, wm::Memory>
loadFromDisk(
QString directory,
const armem::client::QueryInput& queryInput,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment