PPI: Remove 'Packet' from debug module names
g0dil [Wed, 22 Aug 2007 11:24:58 +0000 (11:24 +0000)]
PPI: Implement ActiveFeederSource and ActiveFeederSink debug composites

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@406 270642c3-0616-0410-b53a-bc976706d245

15 files changed:
PPI/ActiveFeeder.test.cc
PPI/Connectors.test.cc
PPI/DebugModules.cci
PPI/DebugModules.hh
PPI/DebugModules.test.cc
PPI/Joins.test.cc
PPI/Module.test.cc
PPI/PassiveQueue.test.cc
PPI/Queueing.test.cc
PPI/Route.test.cc
PPI/Setup.cti
PPI/Setup.hh
PPI/SocketReader.test.cc
PPI/SocketWriter.test.cc
PPI/predecl.hh

index e5c66d2..ac413c0 100644 (file)
@@ -43,8 +43,8 @@ namespace module = senf::ppi::module;
 
 BOOST_AUTO_UNIT_TEST(activeFeeder)
 {
-    debug::PassivePacketSource source;
-    debug::PassivePacketSink sink;
+    debug::PassiveSource source;
+    debug::PassiveSink sink;
     module::ActiveFeeder feeder;
 
     ppi::connect(source,feeder);
index 3a4b621..9277a34 100644 (file)
@@ -49,8 +49,8 @@ BOOST_AUTO_UNIT_TEST(connector)
     // It doesn't matter, which type of connectors we use here since they are all based on
     // Connector.
 
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
@@ -63,13 +63,13 @@ BOOST_AUTO_UNIT_TEST(connector)
 
 BOOST_AUTO_UNIT_TEST(passiveConnector)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
 
-    // onRequest is implicitly tested within the PassivePacketSink implementation which is tested
+    // onRequest is implicitly tested within the PassiveSink implementation which is tested
     // in DebugModules.test.cc
 
     target.input.throttle();
@@ -92,8 +92,8 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(activeConnector)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
@@ -124,16 +124,16 @@ BOOST_AUTO_UNIT_TEST(activeConnector)
 
 BOOST_AUTO_UNIT_TEST(inputConnector)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
 
-    // operator() is implicitly tested within the Active/PassivePacketSink implementation which is
+    // operator() is implicitly tested within the Active/PassiveSink implementation which is
     // tested in DebugModules.test.cc
 
-    // peek() is implicitly tested within the Active/PassivePacketSink implementation
+    // peek() is implicitly tested within the Active/PassiveSink implementation
 
     BOOST_CHECK_EQUAL ( & target.input.peer(), & source.output );
     
@@ -144,13 +144,13 @@ BOOST_AUTO_UNIT_TEST(inputConnector)
 
 BOOST_AUTO_UNIT_TEST(outputConnector)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
 
-    // operator() is implicitly tested within the Active/PassivePacketSource implementation which is
+    // operator() is implicitly tested within the Active/PassiveSource implementation which is
     // tested in DebugModules.test.cc
 
     BOOST_CHECK_EQUAL( & source.output.peer(), & target.input );
@@ -181,7 +181,7 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(passiveInput)
 {
-    debug::ActivePacketSource source;
+    debug::ActiveSource source;
     PassiveInputTest target;
 
     ppi::connect(source,target);
@@ -224,8 +224,8 @@ BOOST_AUTO_UNIT_TEST(passiveInput)
 
 BOOST_AUTO_UNIT_TEST(passiveOutput)
 {
-    debug::PassivePacketSource source;
-    debug::ActivePacketSink target;
+    debug::PassiveSource source;
+    debug::ActiveSink target;
 
     ppi::connect(source,target);
     ppi::init();
@@ -245,8 +245,8 @@ BOOST_AUTO_UNIT_TEST(passiveOutput)
 
 BOOST_AUTO_UNIT_TEST(activeInput)
 {
-    debug::PassivePacketSource source;
-    debug::ActivePacketSink target;
+    debug::PassiveSource source;
+    debug::ActiveSink target;
 
     ppi::connect(source,target);
     ppi::init();
@@ -270,8 +270,8 @@ BOOST_AUTO_UNIT_TEST(activeInput)
 
 BOOST_AUTO_UNIT_TEST(activeOutput)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source,target);
     ppi::init();
index bbc3e9d..6aa026f 100644 (file)
     \brief DebugModules inline non-template implementation */
 
 // Custom includes
+#include "Setup.hh"
 
 #define prefix_ inline
 ///////////////////////////////cci.p///////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////
-// senf::ppi::module::debug::ActivePacketSource
+// senf::ppi::module::debug::ActiveSource
 
-prefix_ senf::ppi::module::debug::ActivePacketSource::ActivePacketSource()
+prefix_ senf::ppi::module::debug::ActiveSource::ActiveSource()
 {
     noroute(output);
 }
 
-prefix_ void senf::ppi::module::debug::ActivePacketSource::submit(Packet packet)
+prefix_ void senf::ppi::module::debug::ActiveSource::submit(Packet packet)
 {
     output(packet);
 }
 
-prefix_ bool senf::ppi::module::debug::ActivePacketSource::boolean_test()
+prefix_ bool senf::ppi::module::debug::ActiveSource::boolean_test()
     const
 {
     return output;
 }
 
 ///////////////////////////////////////////////////////////////////////////
-// senf::ppi::module::debug::PassivePacketSource
+// senf::ppi::module::debug::PassiveSource
 
-prefix_ senf::ppi::module::debug::PassivePacketSource::PassivePacketSource()
+prefix_ senf::ppi::module::debug::PassiveSource::PassiveSource()
 {
     noroute(output);
-    output.onRequest(&PassivePacketSource::request);
+    output.onRequest(&PassiveSource::request);
 }
 
-prefix_ void senf::ppi::module::debug::PassivePacketSource::submit(Packet packet)
+prefix_ void senf::ppi::module::debug::PassiveSource::submit(Packet packet)
 {
     packets_.push_back(packet);
     output.unthrottle();
 }
 
-prefix_ bool senf::ppi::module::debug::PassivePacketSource::empty()
+prefix_ bool senf::ppi::module::debug::PassiveSource::empty()
 {
     return packets_.empty();
 }
 
-prefix_ senf::ppi::module::debug::PassivePacketSource::size_type
-senf::ppi::module::debug::PassivePacketSource::size()
+prefix_ senf::ppi::module::debug::PassiveSource::size_type
+senf::ppi::module::debug::PassiveSource::size()
 {
     return packets_.size();
 }
@@ -76,7 +77,7 @@ senf::ppi::module::debug::PassivePacketSource::size()
 ////////////////////////////////////////
 // private members
 
-prefix_ void senf::ppi::module::debug::PassivePacketSource::request()
+prefix_ void senf::ppi::module::debug::PassiveSource::request()
 {
     BOOST_ASSERT( ! packets_.empty() );
     output(packets_.front());
@@ -85,64 +86,64 @@ prefix_ void senf::ppi::module::debug::PassivePacketSource::request()
         output.throttle();
 }
 
-prefix_ void senf::ppi::module::debug::PassivePacketSource::init()
+prefix_ void senf::ppi::module::debug::PassiveSource::init()
 {
     if (empty())
         output.throttle();
 }
 
 ///////////////////////////////////////////////////////////////////////////
-// senf::ppi::module::debug::ActivePacketSink
+// senf::ppi::module::debug::ActiveSink
 
-prefix_ senf::ppi::module::debug::ActivePacketSink::ActivePacketSink()
+prefix_ senf::ppi::module::debug::ActiveSink::ActiveSink()
 {
     noroute(input);
 }
 
-prefix_ senf::Packet senf::ppi::module::debug::ActivePacketSink::request()
+prefix_ senf::Packet senf::ppi::module::debug::ActiveSink::request()
 {
     return input();
 }
 
-prefix_ bool senf::ppi::module::debug::ActivePacketSink::boolean_test()
+prefix_ bool senf::ppi::module::debug::ActiveSink::boolean_test()
     const
 {
     return input;
 }
 
 ///////////////////////////////////////////////////////////////////////////
-// senf::ppi::module::debug::PassivePacketSink
+// senf::ppi::module::debug::PassiveSink
 
-prefix_ senf::ppi::module::debug::PassivePacketSink::PassivePacketSink()
+prefix_ senf::ppi::module::debug::PassiveSink::PassiveSink()
 {
     noroute(input);
-    input.onRequest(&PassivePacketSink::request);
+    input.onRequest(&PassiveSink::request);
 }
 
-prefix_ bool senf::ppi::module::debug::PassivePacketSink::empty()
+prefix_ bool senf::ppi::module::debug::PassiveSink::empty()
 {
     return packets_.empty();
 }
 
-prefix_ senf::ppi::module::debug::PassivePacketSink::size_type
-senf::ppi::module::debug::PassivePacketSink::size()
+prefix_ senf::ppi::module::debug::PassiveSink::size_type
+senf::ppi::module::debug::PassiveSink::size()
 {
     return packets_.size();
 }
 
-prefix_ senf::ppi::module::debug::PassivePacketSink::iterator
-senf::ppi::module::debug::PassivePacketSink::begin()
+prefix_ senf::ppi::module::debug::PassiveSink::iterator
+senf::ppi::module::debug::PassiveSink::begin()
 {
     return packets_.begin();
 }
 
-prefix_ senf::ppi::module::debug::PassivePacketSink::iterator
-senf::ppi::module::debug::PassivePacketSink::end()
+prefix_ senf::ppi::module::debug::PassiveSink::iterator
+senf::ppi::module::debug::PassiveSink::end()
 {
     return packets_.end();
 }
 
-prefix_ senf::Packet senf::ppi::module::debug::PassivePacketSink::front()
+prefix_ senf::Packet senf::ppi::module::debug::PassiveSink::front()
 {
     if (empty())
         return Packet();
@@ -150,7 +151,7 @@ prefix_ senf::Packet senf::ppi::module::debug::PassivePacketSink::front()
         return packets_.front();
 }
 
-prefix_ senf::Packet senf::ppi::module::debug::PassivePacketSink::pop_front()
+prefix_ senf::Packet senf::ppi::module::debug::PassiveSink::pop_front()
 {
     Packet p (front());
     if (p) 
@@ -158,7 +159,7 @@ prefix_ senf::Packet senf::ppi::module::debug::PassivePacketSink::pop_front()
     return p;
 }
 
-prefix_ void senf::ppi::module::debug::PassivePacketSink::clear()
+prefix_ void senf::ppi::module::debug::PassiveSink::clear()
 {
     packets_.erase(packets_.begin(), packets_.end());
 }
@@ -166,11 +167,83 @@ prefix_ void senf::ppi::module::debug::PassivePacketSink::clear()
 ////////////////////////////////////////
 // private members
 
-prefix_ void senf::ppi::module::debug::PassivePacketSink::request()
+prefix_ void senf::ppi::module::debug::PassiveSink::request()
 {
     packets_.push_back(input());
 }
 
+///////////////////////////////////////////////////////////////////////////
+// senf::ppi::module::debug::ActiveFeederSource
+
+prefix_ senf::ppi::module::debug::ActiveFeederSource::ActiveFeederSource()
+    : output(feeder.output)
+{
+    ppi::connect(source,feeder);
+}
+
+prefix_ void senf::ppi::module::debug::ActiveFeederSource::submit(Packet packet)
+{
+    source.submit(packet);
+}
+
+prefix_ bool senf::ppi::module::debug::ActiveFeederSource::empty()
+{
+    return source.empty();
+}
+
+prefix_ senf::ppi::module::debug::ActiveFeederSource::size_type
+senf::ppi::module::debug::ActiveFeederSource::size()
+{
+    return source.size();
+}
+
+///////////////////////////////////////////////////////////////////////////
+// senf::ppi::module::debug::ActiveFeederSink
+
+prefix_ senf::ppi::module::debug::ActiveFeederSink::ActiveFeederSink()
+    : input(feeder.input)
+{
+    ppi::connect(feeder, sink);
+}
+
+prefix_ bool senf::ppi::module::debug::ActiveFeederSink::empty()
+{
+    return sink.empty();
+}
+
+prefix_ senf::ppi::module::debug::ActiveFeederSink::size_type
+senf::ppi::module::debug::ActiveFeederSink::size()
+{
+    return sink.size();
+}
+
+prefix_ senf::ppi::module::debug::ActiveFeederSink::iterator
+senf::ppi::module::debug::ActiveFeederSink::begin()
+{
+    return sink.begin();
+}
+
+prefix_ senf::ppi::module::debug::ActiveFeederSink::iterator
+senf::ppi::module::debug::ActiveFeederSink::end()
+{
+    return sink.end();
+}
+
+prefix_ senf::Packet senf::ppi::module::debug::ActiveFeederSink::front()
+{
+    return sink.front();
+}
+
+prefix_ senf::Packet senf::ppi::module::debug::ActiveFeederSink::pop_front()
+{
+    return sink.pop_front();
+}
+
+prefix_ void senf::ppi::module::debug::ActiveFeederSink::clear()
+{
+    sink.clear();
+}
+
 ///////////////////////////////cci.e///////////////////////////////////////
 #undef prefix_
 
index 2c70982..ad76884 100644 (file)
@@ -31,6 +31,7 @@
 #include "Utils/SafeBool.hh"
 #include "Packets/Packets.hh"
 #include "Module.hh"
+#include "ActiveFeeder.hh"
 
 //#include "DebugModules.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -51,33 +52,33 @@ namespace debug {
     
     /** \brief
      */
-    class ActivePacketSource
+    class ActiveSource
         : public Module, 
-          public SafeBool<ActivePacketSource>
+          public SafeBool<ActiveSource>
     {
-        SENF_PPI_MODULE(ActivePacketSource);
+        SENF_PPI_MODULE(ActiveSource);
 
     public:
         connector::ActiveOutput output;
 
-        ActivePacketSource();
+        ActiveSource();
 
         void submit(Packet packet);
 
         bool boolean_test() const;
     };
 
-    class PassivePacketSource
+    class PassiveSource
         : public Module
     {
-        SENF_PPI_MODULE(PassivePacketSource);
+        SENF_PPI_MODULE(PassiveSource);
 
         typedef std::deque<Packet> Queue;
 
     public:
         typedef Queue::size_type size_type;
         
-        PassivePacketSource();
+        PassiveSource();
         
         connector::PassiveOutput output;
         
@@ -93,26 +94,26 @@ namespace debug {
         Queue packets_;
     };
 
-    class ActivePacketSink
+    class ActiveSink
         : public Module,
-          public SafeBool<ActivePacketSink>
+          public SafeBool<ActiveSink>
     {
-        SENF_PPI_MODULE(ActivePacketSink);
+        SENF_PPI_MODULE(ActiveSink);
 
     public:
         connector::ActiveInput input;
 
-        ActivePacketSink();
+        ActiveSink();
 
         Packet request();
 
         bool boolean_test() const;
     };
 
-    class PassivePacketSink
+    class PassiveSink
         : public Module
     {
-        SENF_PPI_MODULE(PassivePacketSink);
+        SENF_PPI_MODULE(PassiveSink);
 
         typedef std::deque<Packet> Queue;
 
@@ -122,7 +123,7 @@ namespace debug {
 
         connector::PassiveInput input;
         
-        PassivePacketSink();
+        PassiveSink();
 
         bool empty();
         size_type size();
@@ -140,6 +141,49 @@ namespace debug {
         Queue packets_;
     };
 
+    class ActiveFeederSource
+    {
+    private:
+        PassiveSource source;
+        ActiveFeeder feeder;
+
+    public:
+        typedef PassiveSource::size_type size_type;
+        
+        connector::ActiveOutput & output;
+
+        ActiveFeederSource();
+
+        void submit(Packet packet);
+        bool empty();
+        size_type size();
+    };
+
+    class ActiveFeederSink
+    {
+    private:
+        PassiveSink sink;
+        ActiveFeeder feeder;
+
+    public:
+        typedef PassiveSink::size_type size_type;
+        typedef PassiveSink::iterator iterator;
+
+        connector::ActiveInput & input;
+        
+        ActiveFeederSink();
+
+        bool empty();
+        size_type size();
+        iterator begin();
+        iterator end();
+
+        Packet front();
+        Packet pop_front();
+
+        void clear();
+    };
+
 }}}}
 
 ///////////////////////////////hh.e////////////////////////////////////////
index 4df0c2a..1f6f668 100644 (file)
@@ -44,8 +44,8 @@ namespace ppi = senf::ppi;
 BOOST_AUTO_UNIT_TEST(debugModules)
 {
     {
-        debug::ActivePacketSource source;
-        debug::PassivePacketSink sink;
+        debug::ActiveSource source;
+        debug::PassiveSink sink;
 
         ppi::connect(source, sink);
         ppi::init();
@@ -61,7 +61,7 @@ BOOST_AUTO_UNIT_TEST(debugModules)
         BOOST_CHECK_EQUAL( sink.size(), 1u );
         BOOST_CHECK( ! sink.empty() );
         BOOST_CHECK_EQUAL( 
-            debug::PassivePacketSink::size_type(std::distance(sink.begin(),sink.end())),
+            debug::PassiveSink::size_type(std::distance(sink.begin(),sink.end())),
             sink.size() );
         BOOST_CHECK( *sink.begin() == p );
         BOOST_CHECK( sink.front() == p );
@@ -73,8 +73,8 @@ BOOST_AUTO_UNIT_TEST(debugModules)
     }
 
     {
-        debug::PassivePacketSource source;
-        debug::ActivePacketSink sink;
+        debug::PassiveSource source;
+        debug::ActiveSink sink;
 
         ppi::connect(source, sink);
         ppi::init();
@@ -91,6 +91,43 @@ BOOST_AUTO_UNIT_TEST(debugModules)
     }
 }
 
+BOOST_AUTO_UNIT_TEST(activeFeederSource)
+{
+    debug::ActiveFeederSource source;
+    debug::PassiveSink sink;
+
+    ppi::connect(source,sink);
+
+    source.submit(senf::DataPacket::create());
+    
+    ppi::run();
+
+    BOOST_CHECK( source.empty() );
+    BOOST_CHECK_EQUAL( source.size(), 0u );
+    BOOST_CHECK_EQUAL( sink.size(), 1u );
+}
+
+BOOST_AUTO_UNIT_TEST(activeFeederSink)
+{
+    debug::PassiveSource source;
+    debug::ActiveFeederSink sink;
+
+    ppi::connect(source,sink);
+
+    source.submit(senf::DataPacket::create());
+    
+    ppi::run();
+
+    BOOST_CHECK( ! sink.empty() );
+    BOOST_CHECK_EQUAL( sink.size(), 1u );
+    BOOST_CHECK_EQUAL( debug::ActiveFeederSink::size_type(std::distance(sink.begin(), sink.end())),
+                       sink.size() );
+    BOOST_CHECK( sink.front().data().empty() );
+    BOOST_CHECK( sink.pop_front().data().empty() );
+    BOOST_CHECK( sink.empty() );
+    BOOST_CHECK( source.empty() );
+}
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
index 8e336bb..7f07983 100644 (file)
@@ -45,10 +45,10 @@ namespace debug = module::debug;
 
 BOOST_AUTO_UNIT_TEST(passiveJoin)
 {
-    debug::ActivePacketSource source1;
-    debug::ActivePacketSource source2;
+    debug::ActiveSource source1;
+    debug::ActiveSource source2;
     module::PassiveJoin join;
-    debug::PassivePacketSink sink;
+    debug::PassiveSink sink;
 
     ppi::connect(source1, join);
     ppi::connect(source2, join);
@@ -75,10 +75,10 @@ BOOST_AUTO_UNIT_TEST(passiveJoin)
 
 BOOST_AUTO_UNIT_TEST(priorityJoin)
 {
-    debug::PassivePacketSource source1;
-    debug::PassivePacketSource source2;
+    debug::PassiveSource source1;
+    debug::PassiveSource source2;
     module::PriorityJoin join;
-    debug::ActivePacketSink sink;
+    debug::ActiveSink sink;
 
     ppi::connect(source1, join);
     ppi::connect(source2, join);
index 96d65da..a844abb 100644 (file)
@@ -69,7 +69,7 @@ BOOST_AUTO_UNIT_TEST(module)
     // route and registerEvent are tested in Route.test.cc
 
     TestModule tester;
-    debug::PassivePacketSink sink;
+    debug::PassiveSink sink;
     ppi::connect(tester, sink);
     ppi::init();
 
index 3c5c66f..c77465e 100644 (file)
@@ -45,9 +45,9 @@ namespace debug = module::debug;
 
 BOOST_AUTO_UNIT_TEST(passiveQueue)
 {
-    debug::ActivePacketSource source;
+    debug::ActiveSource source;
     module::PassiveQueue queue;
-    debug::ActivePacketSink sink;
+    debug::ActiveSink sink;
 
     ppi::connect(source,queue);
     ppi::connect(queue,sink);
index cd256b6..c9ae4ea 100644 (file)
@@ -71,9 +71,9 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(thresholdQueueing)
 {
-    debug::ActivePacketSource source;
+    debug::ActiveSource source;
     QueueTester tester;
-    debug::PassivePacketSink sink;
+    debug::PassiveSink sink;
 
     ppi::connect(source, tester);
     ppi::connect(tester, sink);
index be33ee6..9184960 100644 (file)
@@ -105,10 +105,10 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(route)
 {
-    debug::PassivePacketSource passiveSource;
-    debug::ActivePacketSource activeSource;
-    debug::PassivePacketSink passiveSink;
-    debug::ActivePacketSink activeSink;
+    debug::PassiveSource passiveSource;
+    debug::ActiveSource activeSource;
+    debug::PassiveSink passiveSink;
+    debug::ActiveSink activeSink;
     RouteTester tester;
 
     ppi::connect(passiveSource, tester.activeIn);
index caf151f..b32b906 100644 (file)
 
 #ifndef DOXYGEN
 
-template <class M, class C>
-prefix_ void
-senf::ppi::connect(M & source, C & target,
-                   typename boost::enable_if< boost::is_base_of<module::Module, M> >::type *,
-                   typename boost::enable_if< boost::is_base_of<connector::Connector, C> >::type *)
+template <class T, class C>
+prefix_ void senf::ppi::
+connect(T & source, C & target,
+        typename boost::disable_if< boost::is_base_of<connector::Connector, T> >::type *,
+        typename boost::enable_if< boost::is_base_of<connector::Connector, C> >::type *)
 {
     connect(source.output, target);
 }
 
-template <class C, class M>
-prefix_ void
-senf::ppi::connect(C & source, M & target,
-                   typename boost::enable_if< boost::is_base_of<connector::Connector, C> >::type *,
-                   typename boost::enable_if< boost::is_base_of<module::Module, M> >::type *)
+template <class C, class T>
+prefix_ void senf::ppi::
+connect(C & source, T & target,
+        typename boost::enable_if< boost::is_base_of<connector::Connector, C> >::type *,
+        typename boost::disable_if< boost::is_base_of<connector::Connector,T> >::type *)
 {
     connect(source, target.input);
 }
 
-template <class M1, class M2>
-prefix_ void
-senf::ppi::connect(M1 & source, M2 & target,
-                   typename boost::enable_if< boost::is_base_of<module::Module, M1> >::type *,
-                   typename boost::enable_if< boost::is_base_of<module::Module, M2> >::type *)
+template <class T1, class T2>
+prefix_ void senf::ppi::
+connect(T1 & source, T2 & target,
+        typename boost::disable_if< boost::is_base_of<connector::Connector, T1> >::type *,
+        typename boost::disable_if< boost::is_base_of<connector::Connector, T2> >::type *)
 {
     connect(source.output, target.input);
 }
index 57215b1..cadee67 100644 (file)
@@ -27,6 +27,8 @@
 #define HH_Setup_ 1
 
 // Custom includes
+#include <boost/type_traits.hpp>
+#include <boost/utility/enable_if.hpp>
 #include "predecl.hh"
 
 //#include "Setup.mpp"
@@ -40,20 +42,20 @@ namespace ppi {
     void connect(connector::ActiveOutput & source, connector::PassiveInput & target);
     void connect(connector::PassiveOutput & source, connector::ActiveInput & target);
     
-    template <class M, class C>
-    void connect(M & source, C & target,
-                 typename boost::enable_if< boost::is_base_of<module::Module, M> >::type * = 0,
+    template <class T, class C>
+    void connect(T & source, C & target,
+                 typename boost::disable_if< boost::is_base_of<connector::Connector, T> >::type * = 0,
                  typename boost::enable_if< boost::is_base_of<connector::Connector, C> >::type * = 0);
 
-    template <class C, class M>
-    void connect(C & source, M & target,
+    template <class C, class T>
+    void connect(C & source, T & target,
                  typename boost::enable_if< boost::is_base_of<connector::Connector, C> >::type * = 0,
-                 typename boost::enable_if< boost::is_base_of<module::Module, M> >::type * = 0);
+                 typename boost::disable_if< boost::is_base_of<connector::Connector,T> >::type * = 0);
 
-    template <class M1, class M2>
-    void connect(M1 & source, M2 & target,
-                 typename boost::enable_if< boost::is_base_of<module::Module, M1> >::type * = 0,
-                 typename boost::enable_if< boost::is_base_of<module::Module, M2> >::type * = 0);
+    template <class T1, class T2>
+    void connect(T1 & source, T2 & target,
+                 typename boost::disable_if< boost::is_base_of<connector::Connector, T1> >::type * = 0,
+                 typename boost::disable_if< boost::is_base_of<connector::Connector, T2> >::type * = 0);
 
 #else
 
index ca0631c..6c6f3b4 100644 (file)
@@ -57,7 +57,7 @@ BOOST_AUTO_UNIT_TEST(socketReader)
     inputSocket.bind(senf::INet4SocketAddress("localhost:44344"));
     inputSocket.blocking(false);
     module::ActiveSocketReader<> udpReader(inputSocket);
-    debug::PassivePacketSink sink;
+    debug::PassiveSink sink;
     ppi::connect(udpReader, sink);
 
     std::string data ("TEST");
index 63dd2a8..83985ca 100644 (file)
@@ -56,7 +56,7 @@ BOOST_AUTO_UNIT_TEST(passiveSocketWriter)
     senf::ConnectedUDPv4ClientSocketHandle outputSocket (
         senf::INet4SocketAddress("localhost:44344"));
     module::PassiveSocketWriter<> udpWriter(outputSocket);
-    debug::ActivePacketSource source;
+    debug::ActiveSource source;
     ppi::connect(source, udpWriter);
 
     std::string data ("TEST");
@@ -76,7 +76,7 @@ BOOST_AUTO_UNIT_TEST(activeSocketWriter)
     senf::ConnectedUDPv4ClientSocketHandle outputSocket (
         senf::INet4SocketAddress("localhost:44344"));
     module::ActiveSocketWriter<> udpWriter(outputSocket);
-    debug::PassivePacketSource source;
+    debug::PassiveSource source;
     ppi::connect(source, udpWriter);
 
     std::string data ("TEST");
index 49eae2b..8fb57dd 100644 (file)
@@ -27,7 +27,6 @@
 #define HH_predecl_ 1
 
 // Custom includes
-#include <boost/type_traits.hpp>
 
 //#include "predecl.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////