PPI: Replace LogSink with Logger monitor module
g0dil [Tue, 11 Aug 2009 20:07:01 +0000 (20:07 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1287 270642c3-0616-0410-b53a-bc976706d245

PPI/DebugModules.cti
PPI/DebugModules.hh
PPI/DebugModules.test.cc

index d603cc8..f9b90d5 100644 (file)
 ///////////////////////////////cti.p///////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////
-// senf::ppi::module::debug::LogSink<Stream,Area,level>
+// senf::ppi::module::debug::Logger<Stream,Area,level>
 
 template <class Stream, class Area, class Level>
-prefix_ senf::ppi::module::debug::LogSink<Stream,Area,Level>::LogSink()
-{
-    noroute(input);
-    input.onRequest(&LogSink::request);
-}
+prefix_ senf::ppi::module::debug::Logger<Stream,Area,Level>::Logger()
+{}
 
 ////////////////////////////////////////
 // private members
 
 template <class Stream, class Area, class Level>
-prefix_ void senf::ppi::module::debug::LogSink<Stream,Area,Level>::request()
+prefix_ void
+senf::ppi::module::debug::Logger<Stream,Area,Level>::v_handlePacket(Packet const & packet)
 {
-    Packet packet (input());
     SENF_LOG_BLOCK_TPL((Stream)(Area)(Level)({
         packet.dump(log);
         hexdump(packet.last().data().begin(), packet.last().data().end(),log);
index 1ea0f2b..f382dd6 100644 (file)
@@ -30,7 +30,7 @@
 #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"
 
@@ -269,18 +269,15 @@ 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();
 
     private:
-        void request();
+        virtual void v_handlePacket(Packet const & packet);
     };
 
 }}}}
index fa198bd..76a1d45 100644 (file)
@@ -134,9 +134,9 @@ BOOST_AUTO_UNIT_TEST(logSink)
     logTarget.route<senf::log::Debug,senf::log::VERBOSE>();
 
     debug::ActiveFeederSource source;
-    debug::LogSink<> sink;
+    debug::Logger<> logger;
 
-    ppi::connect(source,sink);
+    ppi::connect(source,logger);
     senf::PacketData::byte data[] = { 0x13u, 0x24u, 0x35u };
     source.submit( senf::DataPacket::create(data) );
     senf::ppi::run();