Replace SENFSCons.InstallIncludeFiles with InstallSubdir builder calls
[senf.git] / PPI / Joins.hh
index f7c1c3e..6c260c0 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
-// Copyright (C) 2007 
-// Fraunhofer Institute for Open Communication Systems (FOKUS) 
-// Competence Center NETwork research (NET), St. Augustin, GERMANY 
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 /** \file
     \brief Joins public header */
 
-#ifndef HH_Joins_
-#define HH_Joins_ 1
+#ifndef HH_SENF_PPI_Joins_
+#define HH_SENF_PPI_Joins_ 1
 
 // Custom includes
 #include <boost/ptr_container/ptr_vector.hpp>
 #include "predecl.hh"
 #include "Connectors.hh"
 #include "Module.hh"
+#include "MultiConnectorMixin.hh"
 
 //#include "Joins.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
 namespace senf {
 namespace ppi {
 
-#ifndef DOXYGEN
-
-    template <class Source>
-    connector::GenericPassiveInput & connect(Source & source, module::PassiveJoin & target);
-    
-    template <class Source>
-    connector::GenericActiveInput & connect(Source & source, module::PriorityJoin & target);
-
-#endif
-
 namespace module {
 
     /** \brief Join multiple packet streams with passive inputs
 
         The PassiveJoin will combine any number of packet streams. You may connect any number of
-        GenericActiveOutput's  to the PassiveJoin instance. The combined stream is then provided on the
-        GenericActiveOutput \a output.
+        ActiveOutput<>'s  to the PassiveJoin instance. The combined stream is then provided on the
+        ActiveOutput<> \a output.
 
         Since PassiveJoin allows any number of incoming packet streams, the input connectors are
         dynamically managed. A special senf::ppi::connect() overload is used to dynamically create
@@ -70,38 +61,29 @@ namespace module {
         \ingroup routing_modules
      */
     class PassiveJoin
-        : public Module
+        : public Module,
+          public MultiConnectorMixin<PassiveJoin, connector::PassiveInput<> >
     {
         SENF_PPI_MODULE(PassiveJoin);
     public:
-        connector::GenericActiveOutput output;
+        connector::ActiveOutput<> output;
 
         PassiveJoin();
 
     private:
-        connector::GenericPassiveInput & newInput();
-
-#ifndef DOXYGEN
-        // I didn't get template friend functions to work ...
-    public:
-#endif
-        template <class Source>
-        connector::GenericPassiveInput & connect(Source & source);
-
-    private:
+        void connectorSetup(connector::PassiveInput<> & conn);
         void request(connector::GenericPassiveInput & input);
         void onThrottle();
         void onUnthrottle();
 
-        typedef boost::ptr_vector<connector::GenericPassiveInput > Inputs;
-        Inputs inputs_;
+        friend class MultiConnectorMixin<PassiveJoin, connector::PassiveInput<> >;
     };
 
     /** \brief Join multiple packet streams with active inputs
 
         The PriorityJoin will combine any number of packet streams. You may connect any number of
-        GenericPassiveInput's  to the PassiveJoin instance. The combined stream is then provided on the
-        GenericPassiveOutput \a output.
+        PassiveInput<>'s  to the PassiveJoin instance. The combined stream is then provided on the
+        PassiveOutput<> \a output.
 
         When a packet request is received on Priorityjoin's \a output, The request will be serviced
         from the first unthrottled input. The order, in which connectors are connected to the
@@ -120,34 +102,26 @@ namespace module {
         \endcode
         Here, \a module1 has higher priority than \a module2 which will only be queried if \a
         module1 is throttled.
-        
+
         \ingroup routing_modules
      */
     class PriorityJoin
-        : public Module
+        : public Module,
+          public MultiConnectorMixin<PriorityJoin, connector::ActiveInput<> >
     {
         SENF_PPI_MODULE(PriorityJoin);
     public:
-        connector::GenericPassiveOutput output;
+        connector::PassiveOutput<> output;
 
         PriorityJoin();
 
     private:
-        connector::GenericActiveInput & newInput();
-
-#ifndef DOXYGEN
-    public:
-#endif
-        template <class Source>
-        connector::GenericActiveInput & connect(Source & source);
-
-    private:
+        void connectorSetup(PriorityJoin::ConnectorType & conn, int priority=-1);
         void request();
         void onThrottle();
         void onUnthrottle();
 
-        typedef boost::ptr_vector<connector::GenericActiveInput> Inputs;
-        Inputs inputs_;
+        friend class MultiConnectorMixin<PriorityJoin, connector::ActiveInput<> >;
     };
 
 }}}
@@ -155,7 +129,7 @@ namespace module {
 ///////////////////////////////hh.e////////////////////////////////////////
 #include "Joins.cci"
 //#include "Joins.ct"
-#include "Joins.cti"
+//#include "Joins.cti"
 #endif
 
 \f