PPI: BUGFIX: Duplicate connector registration
[senf.git] / PPI / DebugModules.hh
index 536a10c..27212c6 100644 (file)
 /** \file
     \brief DebugModules public header */
 
-#ifndef HH_DebugModules_
-#define HH_DebugModules_ 1
+#ifndef HH_SENF_PPI_DebugModules_
+#define HH_SENF_PPI_DebugModules_ 1
 
 // Custom includes
 #include <deque>
 #include "../Utils/safe_bool.hh"
 #include "../Packets/Packets.hh"
-#include "Module.hh"
+#include "MonitorModule.hh"
 #include "ActiveFeeder.hh"
 #include "../Utils/Logger/SenfLog.hh"
 
@@ -84,7 +84,7 @@ namespace debug {
 
         ActiveSource();
 
-        void submit(Packet packet);     ///< Submit packet
+        void submit(Packet const & packet);     ///< Submit packet
                                         /**< \pre boolean_test() is \c true */
 
         bool boolean_test() const;      ///< \c true if \a output is not throttled
@@ -113,14 +113,14 @@ namespace debug {
         void throttle();                ///< Throttle output connector
         void unthrottle();              ///< Unthrottle output connector
 
-        void submit(Packet packet);     ///< Enqueue packet
+        void submit(Packet const & packet);     ///< Enqueue packet
 
         bool empty();                   ///< \c true if queue is empty
         size_type size();               ///< Number of packets in queue
 
     private:
         void request();
-        void init();
+        virtual void v_init();
 
         Queue packets_;
     };
@@ -229,9 +229,9 @@ namespace debug {
         throttled.
 
         \note ActiveFeederSink does \e not have a termination condition like ActiveFeederSource, it
-            relies on the network to throttle it's input. Also, the same not as for
-            ActiveFeederSource applies here too: You need to ensure, that no events are active
-            eventually or senf::ppi::run will not return.
+            relies on the network to throttle it's input. Additionally, the restrictions of
+            ActiveFeederSource apply here too: You need to ensure, that no (additional) events are
+            active (eventually) or senf::ppi::run will not return.
 
         ActiveFeederSink is not a module but a collection of two modules: a PassiveSink and an
         ActiveFeeder.
@@ -269,18 +269,18 @@ namespace debug {
     template < class Stream = log::Debug,
                class Area   = log::DefaultArea,
                class Level  = log::VERBOSE >
-    class LogSink
-        : public module::Module
+    class Logger
+        : public MonitorModule<>
     {
-        SENF_PPI_MODULE(LogSink);
+        SENF_PPI_MODULE(Logger);
     public:
-
-        connector::PassiveInput<> input;
-
-        LogSink();
+        Logger();
+        explicit Logger(std::string label);
 
     private:
-        void request();
+        virtual void v_handlePacket(Packet const & packet);
+
+        std::string label_;
     };
 
 }}}}