From 3b41c2b99109d746ace57ce165c6285a6bbf7358 Mon Sep 17 00:00:00 2001
From: Rainer Kartmann <rainer.kartmann@kit.edu>
Date: Wed, 29 Nov 2023 15:46:41 +0100
Subject: [PATCH] Rename component to MemoryToDebugObserver

---
 .../components/armem/client/CMakeLists.txt    |  2 +-
 .../armem/client/MemoryPlotter/CMakeLists.txt | 21 ------------
 .../MemoryToDebugObserver/CMakeLists.txt      | 28 ++++++++++++++++
 .../Component.cpp}                            | 33 +++++++++----------
 .../Component.h}                              | 21 +++++++-----
 5 files changed, 57 insertions(+), 48 deletions(-)
 delete mode 100644 source/RobotAPI/components/armem/client/MemoryPlotter/CMakeLists.txt
 create mode 100644 source/RobotAPI/components/armem/client/MemoryToDebugObserver/CMakeLists.txt
 rename source/RobotAPI/components/armem/client/{MemoryPlotter/MemoryPlotter.cpp => MemoryToDebugObserver/Component.cpp} (91%)
 rename source/RobotAPI/components/armem/client/{MemoryPlotter/MemoryPlotter.h => MemoryToDebugObserver/Component.h} (88%)

diff --git a/source/RobotAPI/components/armem/client/CMakeLists.txt b/source/RobotAPI/components/armem/client/CMakeLists.txt
index 160f90fff..284ce7a27 100644
--- a/source/RobotAPI/components/armem/client/CMakeLists.txt
+++ b/source/RobotAPI/components/armem/client/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_subdirectory(ExampleMemoryClient)
 add_subdirectory(GraspProviderExample)
-add_subdirectory(MemoryPlotter)
+add_subdirectory(MemoryToDebugObserver)
 add_subdirectory(ObjectInstanceToIndex)
 add_subdirectory(RobotStatePredictionClientExample)
 add_subdirectory(SimpleVirtualRobot)
diff --git a/source/RobotAPI/components/armem/client/MemoryPlotter/CMakeLists.txt b/source/RobotAPI/components/armem/client/MemoryPlotter/CMakeLists.txt
deleted file mode 100644
index 401035be3..000000000
--- a/source/RobotAPI/components/armem/client/MemoryPlotter/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-armarx_component_set_name(MemoryPlotter)
-
-set(COMPONENT_LIBS
-    ArmarXCore
-    ArmarXCoreComponentPlugins
-    ArmarXGuiComponentPlugins
-    RobotAPICore RobotAPIInterfaces
-    armem
-)
-
-set(SOURCES
-    MemoryPlotter.cpp
-)
-
-set(HEADERS
-    MemoryPlotter.h
-)
-
-armarx_add_component("${SOURCES}" "${HEADERS}")
-
-armarx_generate_and_add_component_executable()
diff --git a/source/RobotAPI/components/armem/client/MemoryToDebugObserver/CMakeLists.txt b/source/RobotAPI/components/armem/client/MemoryToDebugObserver/CMakeLists.txt
new file mode 100644
index 000000000..77aeec993
--- /dev/null
+++ b/source/RobotAPI/components/armem/client/MemoryToDebugObserver/CMakeLists.txt
@@ -0,0 +1,28 @@
+armarx_component_set_name(MemoryToDebugObserver)
+
+set(COMPONENT_LIBS
+    ArmarXCore
+    ArmarXCoreComponentPlugins
+    ArmarXGuiComponentPlugins
+    RobotAPICore RobotAPIInterfaces
+    armem
+)
+
+set(SOURCES
+    Component.cpp
+)
+
+set(HEADERS
+    Component.h
+)
+
+armarx_add_component("${SOURCES}" "${HEADERS}")
+
+set(COMPONENT_INCLUDE RobotAPI/components/armem/client/MemoryToDebugObserver/Component.h)
+
+armarx_generate_and_add_component_executable(
+    COMPONENT_INCLUDE
+        "${CMAKE_CURRENT_LIST_DIR}/Component.h"
+    COMPONENT_CLASS_NAME
+        Component
+)
diff --git a/source/RobotAPI/components/armem/client/MemoryPlotter/MemoryPlotter.cpp b/source/RobotAPI/components/armem/client/MemoryToDebugObserver/Component.cpp
similarity index 91%
rename from source/RobotAPI/components/armem/client/MemoryPlotter/MemoryPlotter.cpp
rename to source/RobotAPI/components/armem/client/MemoryToDebugObserver/Component.cpp
index d292688d7..6f7e64012 100644
--- a/source/RobotAPI/components/armem/client/MemoryPlotter/MemoryPlotter.cpp
+++ b/source/RobotAPI/components/armem/client/MemoryToDebugObserver/Component.cpp
@@ -13,14 +13,14 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
- * @package    RobotAPI::ArmarXObjects::MemoryPlotter
+ * @package    RobotAPI::ArmarXObjects::MemoryToDebugObserver
  * @author     Rainer Kartmann ( rainer dot kartmann at kit dot edu )
  * @date       2023
  * @copyright  http://www.gnu.org/licenses/gpl-2.0.txt
  *             GNU General Public License
  */
 
-#include "MemoryPlotter.h"
+#include "Component.h"
 
 #include <ArmarXCore/core/time/Frequency.h>
 #include <ArmarXCore/core/time/Metronome.h>
@@ -33,9 +33,8 @@
 namespace armarx
 {
 
-
     armarx::PropertyDefinitionsPtr
-    MemoryPlotter::createPropertyDefinitions()
+    Component::createPropertyDefinitions()
     {
         armarx::PropertyDefinitionsPtr defs =
             new ComponentPropertyDefinitions(getConfigIdentifier());
@@ -44,18 +43,18 @@ namespace armarx
         return defs;
     }
 
-    MemoryPlotter::MemoryPlotter()
+    Component::Component()
     {
     }
 
     std::string
-    MemoryPlotter::getDefaultName() const
+    Component::getDefaultName() const
     {
-        return "MemoryPlotter";
+        return "MemoryToDebugObserver";
     }
 
     void
-    MemoryPlotter::onInitComponent()
+    Component::onInitComponent()
     {
         DebugObserverComponentPluginUser::setDebugObserverBatchModeEnabled(true);
 
@@ -84,28 +83,28 @@ namespace armarx
     }
 
     void
-    MemoryPlotter::onConnectComponent()
+    Component::onConnectComponent()
     {
         createRemoteGuiTab();
         RemoteGui_startRunningTask();
 
-        task = new RunningTask<MemoryPlotter>(this, &MemoryPlotter::runLoop);
+        task = new RunningTask<Component>(this, &Component::runLoop);
         task->start();
     }
 
     void
-    MemoryPlotter::onDisconnectComponent()
+    Component::onDisconnectComponent()
     {
         task->stop();
     }
 
     void
-    MemoryPlotter::onExitComponent()
+    Component::onExitComponent()
     {
     }
 
     void
-    MemoryPlotter::runLoop()
+    Component::runLoop()
     {
         Frequency frequency = Frequency::Hertz(30);
         Metronome metronome(frequency);
@@ -179,7 +178,7 @@ namespace armarx
     };
 
     void
-    MemoryPlotter::loopOnce()
+    Component::loopOnce()
     {
         Visitor visitor(getDebugObserverComponentPlugin());
 
@@ -240,7 +239,7 @@ namespace armarx
     }
 
     armem::client::Reader*
-    MemoryPlotter::getReader(const armem::MemoryID& memoryID, std::stringstream& log)
+    Component::getReader(const armem::MemoryID& memoryID, std::stringstream& log)
     {
         armem::MemoryID key = memoryID.getProviderSegmentID();
 
@@ -268,7 +267,7 @@ namespace armarx
     }
 
     void
-    MemoryPlotter::createRemoteGuiTab()
+    Component::createRemoteGuiTab()
     {
         using namespace armarx::RemoteGui::Client;
 
@@ -281,7 +280,7 @@ namespace armarx
     }
 
     void
-    MemoryPlotter::RemoteGui_update()
+    Component::RemoteGui_update()
     {
         if (tab.rebuild.exchange(false))
         {
diff --git a/source/RobotAPI/components/armem/client/MemoryPlotter/MemoryPlotter.h b/source/RobotAPI/components/armem/client/MemoryToDebugObserver/Component.h
similarity index 88%
rename from source/RobotAPI/components/armem/client/MemoryPlotter/MemoryPlotter.h
rename to source/RobotAPI/components/armem/client/MemoryToDebugObserver/Component.h
index e60c3dae4..dc22c02da 100644
--- a/source/RobotAPI/components/armem/client/MemoryPlotter/MemoryPlotter.h
+++ b/source/RobotAPI/components/armem/client/MemoryToDebugObserver/Component.h
@@ -13,7 +13,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
- * @package    RobotAPI::ArmarXObjects::MemoryPlotter
+ * @package    RobotAPI::ArmarXObjects::MemoryToDebugObserver
  * @author     Rainer Kartmann ( rainer dot kartmann at kit dot edu )
  * @date       2023
  * @copyright  http://www.gnu.org/licenses/gpl-2.0.txt
@@ -22,7 +22,6 @@
 
 #pragma once
 
-
 #include <ArmarXCore/core/Component.h>
 #include <ArmarXCore/interface/observers/ObserverInterface.h>
 #include <ArmarXCore/libraries/ArmarXCoreComponentPlugins/DebugObserverComponentPlugin.h>
@@ -45,25 +44,29 @@ namespace armarx
         aron::Path aronPath;
     };
 
+    class MemoryToDebugObserver
+    {
+    };
+
     /**
-     * @defgroup Component-MemoryPlotter MemoryPlotter
+     * @defgroup Component-MemoryToDebugObserver MemoryToDebugObserver
      * @ingroup RobotAPI-Components
      *
      * Transfers data from the memory system to the DebugObserver, allowing to visualize them in
      * the LivePlotter.
      *
-     * @class MemoryPlotter
-     * @ingroup Component-MemoryPlotter
-     * @brief Implementation of \ref Component-MemoryPlotter.
+     * @class Component
+     * @ingroup Component-MemoryToDebugObserver
+     * @brief Implementation of \ref Component-MemoryToDebugObserver.
      */
-    class MemoryPlotter :
+    class Component :
         virtual public armarx::Component,
         virtual public armarx::armem::ClientPluginUser,
         virtual public armarx::DebugObserverComponentPluginUser,
         virtual public armarx::LightweightRemoteGuiComponentPluginUser
     {
     public:
-        MemoryPlotter();
+        Component();
 
         /// @see armarx::ManagedIceObject::getDefaultName()
         std::string getDefaultName() const override;
@@ -98,7 +101,7 @@ namespace armarx
 
         std::map<armem::MemoryID, armem::client::Reader> memoryReaders;
 
-        armarx::RunningTask<MemoryPlotter>::pointer_type task;
+        armarx::RunningTask<Component>::pointer_type task;
 
         struct RemoteGuiTab : RemoteGui::Client::Tab
         {
-- 
GitLab