Fix SCons 1.2.0 build failure
[senf.git] / PPI / AnnotationRouter.hh
index 0787cbb..e438755 100644 (file)
 
 // Custom includes
 #include <boost/ptr_container/ptr_map.hpp>
+#include "../Utils/String.hh"
 #include "Module.hh"
 #include "Connectors.hh"
+#include "MultiConnectorMixin.hh"
 
 //#include "AnnotationRouter.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -38,19 +40,21 @@ namespace senf {
 namespace ppi {
 namespace module {
 
-    /** \brief Route packets to destination according to some annotation value
+    /** \brief %Route packets to destination according to some annotation value
 
         This router takes packet on a single input and directs them to one of it outputs depending
-        on a \link packet_usage_annotation packet annotation\endlink. Each output connected
+        on a \ref packet_usage_annotation "packet annotation". Each output connected
         will be associated with a single annotation value. Incoming packets for which no matching
         output is found are directed to a default output. If this output is left unconnected, those
         packets will be dropped.
 
         The \a AnnotationType template parameter defines the routing key. This annotation must
         support the following operations:
-        \li Comparison with '<'
-        \li Copy-construction
-        \li Output streaming to an ostream via '<<'
+        \li Comparison with '<' (\c LessThanComparable concept)
+        \li Copy construction and copy assignment (\c Copyable und \c Assignable concepts)
+            (e.g. via compiler synthesized copy constructor and assignment operator)
+        \li Output streaming to an ostream via '\c <<' (for error description purposes) (\c
+            OutputStreamable concept)
 
         The following annotation can be used to route the packets according to a mac address.
         \code
@@ -73,7 +77,7 @@ namespace module {
         mac address and allows to pass a senf::MACAddress value as routing key directly:
 
         \code
-        senf::ppi::module::AnnotationRouter router;
+        senf::ppi::module::AnnotationRouter<TargetInterface> router;
 
         senf::ppi::connect(router, target1, senf::MACAddress::from_string("00:1a:2b:04:06:08"));
         \endcode
@@ -90,7 +94,11 @@ namespace module {
         from the container 
      */
     template <class AnnotationType>
-    class AnnotationRouter : public Module
+    class AnnotationRouter 
+        : public Module, 
+          public MultiConnectorMixin< AnnotationRouter<AnnotationType>,
+                                        connector::ActiveOutput<>,
+                                        AnnotationType >
     {
         SENF_PPI_MODULE(AnnotationRouter);
     public:
@@ -102,42 +110,23 @@ namespace module {
         struct DuplicateKeyException : public senf::Exception
         { DuplicateKeyException(AnnotationType const & key) 
               : senf::Exception("Duplicate senf::ppi::module::AnnotationRouter routing key ")
-                { append(boost::lexical_cast<std::string>(key)); } };
-
-    private:
-        connector::ActiveOutput<> & newOutput(AnnotationType const & key);
-
-#ifndef DOXYGEN
-        // I didn't get template friend functions to work ...
-    public:
-#endif
-        template <class Target>
-        connector::GenericActiveOutput & connect(Target & target, AnnotationType const & key);
+                { append( senf::str(key)); } };
 
     private:
+        AnnotationType connectorSetup(connector::ActiveOutput<> & conn, AnnotationType const & key);
         void request();
-        
-        typedef boost::ptr_map<AnnotationType, connector::ActiveOutput<> > Outputs;
-        Outputs outputs_;
-    };
-
-}
-
-#ifndef DOXYGEN
 
-    template <class Target, class AnnotationType, class ArgType>
-    connector::GenericActiveOutput & connect(
-        module::AnnotationRouter<AnnotationType> & source, Target & target, 
-        ArgType const & key);
-
-#endif
+        friend class MultiConnectorMixin< AnnotationRouter<AnnotationType>,
+                                            connector::ActiveOutput<>,
+                                            AnnotationType >;
+    };
 
-}}
+}}}
 
 ///////////////////////////////hh.e////////////////////////////////////////
 //#include "AnnotationRouter.cci"
 #include "AnnotationRouter.ct"
-#include "AnnotationRouter.cti"
+//#include "AnnotationRouter.cti"
 #endif
 
 \f