From 385dafe2d0f0d9ab012189fb9e93f8cc65577aa6 Mon Sep 17 00:00:00 2001 From: phesch <ulila@student.kit.edu> Date: Mon, 23 May 2022 19:54:53 +0200 Subject: [PATCH] Make Reader return BO types for prediction engines --- .../armem/server/PredictingMemoryInterface.ice | 2 +- source/RobotAPI/libraries/armem/client/Reader.cpp | 12 ++++-------- source/RobotAPI/libraries/armem/client/Reader.h | 5 ++--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice b/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice index ead5ad03b..aeae37458 100644 --- a/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice +++ b/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice @@ -18,7 +18,7 @@ module armarx predict(prediction::data::PredictionRequestSeq requests); /* Get a map from memory segments to the prediction engines they support. - * Best used with the armem::core::PrefixMap to easily retrieve + * Best used with the container_map operations to easily retrieve * the available engine selection for fully evaluated MemoryIDs. */ prediction::data::EngineSupportMap getAvailableEngines(); diff --git a/source/RobotAPI/libraries/armem/client/Reader.cpp b/source/RobotAPI/libraries/armem/client/Reader.cpp index ce2d0cfcf..9fb03536b 100644 --- a/source/RobotAPI/libraries/armem/client/Reader.cpp +++ b/source/RobotAPI/libraries/armem/client/Reader.cpp @@ -479,7 +479,7 @@ namespace armarx::armem::client return boResults; } - armem::prediction::data::EngineSupportMap + std::map<MemoryID, std::vector<PredictionEngine>> Reader::getAvailablePredictionEngines() const { if (!predictionPrx) @@ -499,13 +499,9 @@ namespace armarx::armem::client // Just leave engines empty in this case. } - //std::vector<PredictionEngine> boEngines; - //boEngines.reserve(engines.size()); - //for (const auto& engine : engines) - //{ - // boEngines.push_back(armarx::fromIce<PredictionEngine>(engine)); - //} + std::map<MemoryID, std::vector<PredictionEngine>> boMap; + armarx::fromIce(engines, boMap); - return engines; + return boMap; } } // namespace armarx::armem::client diff --git a/source/RobotAPI/libraries/armem/client/Reader.h b/source/RobotAPI/libraries/armem/client/Reader.h index 34b3ce320..02e1442ef 100644 --- a/source/RobotAPI/libraries/armem/client/Reader.h +++ b/source/RobotAPI/libraries/armem/client/Reader.h @@ -178,15 +178,14 @@ namespace armarx::armem::client */ std::vector<PredictionResult> predict(const std::vector<PredictionRequest>& requests) const; - //TODO(phesch): Fix this interface with the proper type /** * @brief Get the list of prediction engines supported by the memory. * * The `predictionPrx` must not be null when calling this function. * - * @return the vector of supported prediction engines + * @return a map from memory containers to their supported engines */ - armem::prediction::data::EngineSupportMap getAvailablePredictionEngines() const; + std::map<MemoryID, std::vector<PredictionEngine>> getAvailablePredictionEngines() const; inline operator bool() const { -- GitLab