diff --git a/include/dynamic-graph/signal-ptr.h b/include/dynamic-graph/signal-ptr.h index 5b0484bfcc65144861de87275182cf8c5697bfa2..b54c07cfe0ce00a196322e16f995e67eb287cd29 100644 --- a/include/dynamic-graph/signal-ptr.h +++ b/include/dynamic-graph/signal-ptr.h @@ -61,11 +61,13 @@ namespace dynamicgraph SignalBase<Time>* getAbstractPtr (); // throw const SignalBase<Time>* getAbstractPtr () const; // throw virtual void plug( SignalBase<Time>* ref ); - virtual void unplug () { plug(NULL); } + //Useless function, didn't find any use of this one - /*virtual bool isPluged () const DYNAMIC_GRAPH_DEPRECATED { + /*virtual void unplug () { plug(NULL); } + virtual bool isPluged () const DYNAMIC_GRAPH_DEPRECATED { return isPlugged (); }*/ + virtual bool isPlugged () const { return (NULL!=signalPtr); } virtual SignalBase<Time>* getPluged () const { return signalPtr; } virtual bool isAbstractPluged () const; diff --git a/tests/signal-ptr.cpp b/tests/signal-ptr.cpp index 964ebf8fd68246a1eeb6222d482caea04246f39b..85c77d6901f33a3ae1bdf594720674b9f33459a7 100644 --- a/tests/signal-ptr.cpp +++ b/tests/signal-ptr.cpp @@ -11,13 +11,13 @@ #include <dynamic-graph/pool.h> #include <iostream> -#define BOOST_TEST_MODULE signal_ptr +//#define BOOST_TEST_MODULE signal_ptr -#include <boost/test/unit_test.hpp> -#include <boost/test/output_test_stream.hpp> +/*#include <boost/test/unit_test.hpp> +#include <boost/test/output_test_stream.hpp>*/ -using boost::test_tools::output_test_stream; +/*using boost::test_tools::output_test_stream; typedef dynamicgraph::SignalPtr<double, int> sigDouble_t; @@ -26,7 +26,7 @@ class DummyClass { public: - std::string proname; + std::string proname;*/ @@ -53,6 +53,10 @@ int main( void ) sigPtrARef.plug( & sigRef ); sigPtrBRef.plug( & sigPtrARef ); + assert(sigRef.isPlugged()!=true); + sigPtrBRef.unplug(); + assert(sigPtrBRef.isPlugged()!=true); + cout << "Sig = "; sigRef.get(cout); cout << std::endl; cout << "SigPtrA = "; sigPtrARef.get(cout); cout << std::endl; cout << "SigPtrB = "; sigPtrBRef.get(cout); cout << std::endl;