From 20681b3741c7c30905c332a2fed2b67f87bbf408 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Tue, 20 Feb 2018 14:08:10 +0100
Subject: [PATCH] Add command to remove a signal from PythonSignalContainer

---
 src/signal-wrapper.cc | 16 ++++++++++++++++
 src/signal-wrapper.hh |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/src/signal-wrapper.cc b/src/signal-wrapper.cc
index fe6e5f1..7e244c7 100644
--- a/src/signal-wrapper.cc
+++ b/src/signal-wrapper.cc
@@ -18,6 +18,7 @@
 
 #include <Python.h>
 #include <dynamic-graph/factory.h>
+#include <dynamic-graph/command-bind.h>
 
 namespace dynamicgraph {
   namespace python {
@@ -37,6 +38,16 @@ namespace dynamicgraph {
     PythonSignalContainer::PythonSignalContainer(const std::string& name)
       : Entity (name)
     {
+      std::string docstring;
+
+      docstring = "    \n"
+        "    Remove a signal\n"
+        "    \n"
+        "      Input:\n"
+        "        - name of the signal\n"
+        "    \n";
+      addCommand("rmSignal",
+	     command::makeCommandVoid1(*this,&PythonSignalContainer::rmSignal,docstring));
     }
 
     void PythonSignalContainer::signalRegistration (const SignalArray<int>& signals)
@@ -44,6 +55,11 @@ namespace dynamicgraph {
       Entity::signalRegistration (signals);
     }
 
+    void PythonSignalContainer::rmSignal (const std::string& name)
+    {
+      Entity::signalDeregistration (name);
+    }
+
     DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(PythonSignalContainer, "PythonSignalContainer");
 
     template <class T, class Time>
diff --git a/src/signal-wrapper.hh b/src/signal-wrapper.hh
index 339b1ba..c26e9ac 100644
--- a/src/signal-wrapper.hh
+++ b/src/signal-wrapper.hh
@@ -41,6 +41,8 @@ namespace dynamicgraph {
         PythonSignalContainer (const std::string& name);
 
         void signalRegistration (const SignalArray<int>& signals);
+
+        void rmSignal (const std::string& name);
     };
 
     template <class T, class Time>
-- 
GitLab