From 092b8bc6d12247e73e27649e8314527abdcaa058 Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Mon, 24 Jan 2011 12:56:52 +0100
Subject: [PATCH] Put back mistakenly removed method pool::getSignal.

---
 include/dynamic-graph/pool.h |  6 ++++++
 src/dgraph/pool.cpp          | 41 +++++++++++++++++++++++++++++++++---
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/include/dynamic-graph/pool.h b/include/dynamic-graph/pool.h
index 4c4cd1a..a3dee57 100644
--- a/include/dynamic-graph/pool.h
+++ b/include/dynamic-graph/pool.h
@@ -88,6 +88,12 @@ namespace dynamicgraph
     void clearPlugin (const std::string& name);
     /*! @} */
 
+    ///
+    /// \brief Get a signal by name
+    ///
+    /// \param sigpath stream containing a string of the form "entity.signal"
+    SignalBase<int>& getSignal( std::istringstream& sigpath );
+
     /*! \brief This method looks for the object named objectName,
       and ask to provide the function functionName with the arguments cmdArg.
       If the method of the object displays some information this will
diff --git a/src/dgraph/pool.cpp b/src/dgraph/pool.cpp
index c7091a5..5baf94a 100644
--- a/src/dgraph/pool.cpp
+++ b/src/dgraph/pool.cpp
@@ -23,11 +23,14 @@
 /* --------------------------------------------------------------------- */
 
 /* --- DYNAMIC-GRAPH --- */
-#include <dynamic-graph/pool.h>
-#include <dynamic-graph/debug.h>
-#include <dynamic-graph/entity.h>
 #include <list>
 #include <typeinfo>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include "dynamic-graph/pool.h"
+#include "dynamic-graph/debug.h"
+#include "dynamic-graph/entity.h"
 
 using namespace dynamicgraph;
 
@@ -240,6 +243,38 @@ commandLine( const std::string& objectName,const std::string& functionName,
     }
 }
 
+static bool
+objectNameParser( std::istringstream& cmdparse,
+		  std::string& objName,
+		  std::string& funName  )
+{
+  const int SIZE=128;
+  char buffer[SIZE];
+  cmdparse >> std::ws;
+  cmdparse.getline( buffer,SIZE,'.' );
+  if(! cmdparse.good () ) // The callback is not an object method
+    return false;
+
+  objName = buffer;
+  //cmdparse.getline( buffer,SIZE );
+  //funName = buffer;
+  cmdparse >> funName;
+  return true;
+}
+
+SignalBase<int>&
+PoolStorage::
+getSignal( std::istringstream& sigpath )
+{
+  std::string objname,signame;
+  if(! objectNameParser( sigpath,objname,signame ) )
+    { DG_THROW ExceptionFactory( ExceptionFactory::UNREFERED_SIGNAL,
+				     "Parse error in signal name" ); }
+
+  Entity& ent = getEntity( objname );
+  return ent.getSignal( signame );
+}
+
 namespace dynamicgraph {
 	//! The global g_pool object.
 	PoolStorage g_pool;
-- 
GitLab