From 51a5bba505264028687b2cd2e59e5be4d83089f7 Mon Sep 17 00:00:00 2001 From: Firat Yusuf Duran <uzivy@student.kit.edu> Date: Sun, 7 Apr 2024 18:31:35 +0200 Subject: [PATCH] fix getProfile --- .../skills/manager/SkillManagerComponentPlugin.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.cpp b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.cpp index 74f56b06e..026953164 100644 --- a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.cpp +++ b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.cpp @@ -2,6 +2,7 @@ #include <any> #include <string> +#include <IceUtil/UUID.h> #include <ArmarXCore/core/Component.h> #include <ArmarXCore/core/time/DateTime.h> #include <ArmarXCore/core/time/ice_conversions.h> @@ -23,7 +24,7 @@ namespace armarx::plugins root.id = "root"; root.parentId.id = ""; root.parentId.hint = ""; - fluxioProfilesMap.insert({root.id, root}); + fluxioProfilesMap["root"] = root; } template<typename T> std::vector<T> SkillManagerComponentPlugin::convertMapValuesToVector(std::map<std::any, T> map) @@ -543,11 +544,15 @@ namespace armarx::plugins } std::optional<skills::FluxioProfile> SkillManagerComponentPlugin::getProfile(const std::string& id){ - return fluxioProfilesMap[id]; + const auto& it = fluxioProfilesMap.find(id); + + if (it != fluxioProfilesMap.end()) { + return it->second; + } } void SkillManagerComponentPlugin::createProfile(skills::FluxioProfile profile){ - fluxioProfilesMap.insert({profile.id, profile}); + fluxioProfilesMap[profile.id] = profile; } void SkillManagerComponentPlugin::updateProfile(skills::FluxioProfile profile){ -- GitLab