From 97bde56ed64b04173e2b4b2f099bb1e58176e26b Mon Sep 17 00:00:00 2001
From: Firat Yusuf Duran <uzivy@student.kit.edu>
Date: Fri, 13 Sep 2024 19:08:09 +0200
Subject: [PATCH] add memory calls to manager

---
 .../SkillManagerComponentPluginUser.cpp       | 39 ++++++++++++++-----
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.cpp b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.cpp
index 90b975e0d..ab4d0bbc8 100644
--- a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.cpp
+++ b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.cpp
@@ -374,6 +374,17 @@ namespace armarx
 
         const bool ret =
             s->second.updateFromIce(skill, providersMap, profilesMap, skillsMap, typesMap);
+
+        std::optional<skills::manager::arondto::FluxioSkill> opt = s->second.toAronXml();
+
+        if (!opt.has_value())
+        {
+            ARMARX_WARNING << "Skill with id " << skill.id << " could not be converted";
+            return false;
+        }
+
+        saveSkill(opt.value());
+
         return ret;
     }
 
@@ -524,10 +535,14 @@ namespace armarx
         auto& profilesMap = this->plugin->fluxioDC.profiles;
         l.unlock();
 
-        auto ret = this->plugin->createProfile(skills::FluxioProfile::FromIce(profile, profilesMap))
-                       .getResult()
-                       .toManagerIce();
-        return ret;
+        armarx::skills::FluxioProfile ret =
+            this->plugin->createProfile(skills::FluxioProfile::FromIce(profile, profilesMap))
+                .getResult();
+
+        addProfile(ret.toManagerAron());
+
+        return ret.toManagerIce();
+        ;
     }
 
     void
@@ -695,8 +710,7 @@ namespace armarx
             return {};
         }
 
-        const std::optional<skills::manager::arondto::FluxioSkill> aronSkill =
-            s->toAronXml();
+        const std::optional<skills::manager::arondto::FluxioSkill> aronSkill = s->toAronXml();
 
         if (!aronSkill.has_value())
         {
@@ -709,16 +723,23 @@ namespace armarx
         return ret.value();
     }
 
-    void SkillManagerComponentPluginUser::saveSkill(const skills::manager::arondto::FluxioSkill& skill) {
+    void
+    SkillManagerComponentPluginUser::saveSkill(const skills::manager::arondto::FluxioSkill& skill)
+    {
         // Implemented in derived class
     }
 
-    std::optional<std::vector<skills::manager::arondto::FluxioSkill>> SkillManagerComponentPluginUser::loadSkills() {
+    std::optional<std::vector<skills::manager::arondto::FluxioSkill>>
+    SkillManagerComponentPluginUser::loadSkills()
+    {
         // Implemented in derived class
         return {};
     }
 
-    void SkillManagerComponentPluginUser::addProfile(const skills::manager::arondto::FluxioProfile& profile) {
+    void
+    SkillManagerComponentPluginUser::addProfile(
+        const skills::manager::arondto::FluxioProfile& profile)
+    {
         // Implemented in derived class
     }
 } // namespace armarx
-- 
GitLab