added PacketType typedef to PPI-writer interface
tho [Wed, 10 Jun 2009 17:24:36 +0000 (17:24 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1228 270642c3-0616-0410-b53a-bc976706d245

Makefile
PPI/SocketSink.hh
Scheduler/TimerEvent.hh
Scheduler/TimerEvent.test.cc

index 532d737..f423bb5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,15 @@ all_docs all_tests all:
 %/build:
        $(SCONS) $*
 
+#----------------------------------------------------------------------
+# remote compile targets
+#----------------------------------------------------------------------
+JOBS := 1
 
+all@% all_docs@% all_test@% build@%:
+       ssh $* "cd `pwd` && $(MAKE) -j $(JOBS) $(firstword $(subst @, ,$@))"
+
+       
 #----------------------------------------------------------------------
 # test coverage
 #----------------------------------------------------------------------
index 74580cc..ee944dd 100644 (file)
@@ -56,6 +56,7 @@ namespace ppi {
                                     senf::DatagramFramingPolicy,
                                     senf::ConnectedCommunicationPolicy>::policy > Handle;
                                         ///< Handle type supported by this writer
+        typedef Packet PacketType;
 
         void operator()(Handle handle, Packet const & packet);
                                         ///< Write \a packet to \a handle
@@ -77,6 +78,7 @@ namespace ppi {
     {
     public:
         typedef HandleType Handle;
+        typedef Packet PacketType;
 
         TargetDgramWriter();            ///< Create TargetDgramWriter with unset target address
         TargetDgramWriter(typename Handle::Address const & target);
@@ -104,6 +106,7 @@ namespace ppi {
             senf::MakeSocketPolicy< senf::WriteablePolicy,
                                     senf::DatagramFramingPolicy>::policy > Handle;
                                         ///< Handle type supported by this writer
+        typedef Packet PacketType;
 
         void source(senf::INet4Address & source);
         senf::INet4Address source();
@@ -132,6 +135,7 @@ namespace ppi {
             senf::MakeSocketPolicy< senf::WriteablePolicy,
                                     senf::DatagramFramingPolicy>::policy > Handle;
                                         ///< Handle type supported by this writer
+        typedef Packet PacketType;
 
         void source(senf::INet6Address & source);
         senf::INet6Address source();
@@ -175,6 +179,7 @@ namespace module {
           {
           public:
               typedef unspecified Handle;                          // type of handle requested
+              typedef unspecified_type PacketType                  // type of packet read
 
               SomeWriter();                                        // EITHER default constructible OR
               SomeWriter(SomeWriter const & other);                // copy constructible
@@ -194,7 +199,7 @@ namespace module {
     public:
         typedef typename Writer::Handle Handle; ///< Handle type requested by writer
 
-        connector::ActiveInput<> input; ///< Input connector from which data is received
+        connector::ActiveInput<typename Writer::PacketType> input; ///< Input connector from which data is received
 
         ActiveSocketSink();             ///< Create non-connected writer
                                         /**< The writer will be disabled until a socket is set
@@ -250,6 +255,7 @@ namespace module {
           {
           public:
               typedef unspecified Handle;                          // type of handle requested
+              typedef unspecified_type PacketType                  // type of packet read
 
               SomeWriter();                                          // EITHER default constructible
               SomeWriter(SomeWriter const & other);                    // OR copy constructible
@@ -269,7 +275,7 @@ namespace module {
     public:
         typedef typename Writer::Handle Handle; ///< Handle type requested by writer
 
-        connector::PassiveInput<> input; ///< Input connector from which data is received
+        connector::PassiveInput<typename Writer::PacketType> input; ///< Input connector from which data is received
 
         PassiveSocketSink();            ///< Create non-connected writer
                                         /**< The writer will be disabled until a socket is set
index d44cd50..6084f11 100644 (file)
@@ -88,9 +88,9 @@ namespace scheduler {
                                              automatically. Use enable() to do so.
                                              \param[in] name Descriptive timer name (purely
                                                  informational)
+                                             \param[in] cb Callback to call
                                              \param[in] timeout timeout time after the timer
                                                  will be disabled
-                                             \param[in] cb Callback to call
                                              \param[in] initiallyEnabled if set \c false, do not
                                                  enable callback automatically. */
         TimerEvent(std::string const & name, Callback const & cb);
index 92e3f77..6a5704a 100644 (file)
@@ -100,7 +100,7 @@ namespace {
 
     void jitterCb(senf::scheduler::TimerEvent & tm)
     {
-        std::cerr << "diff:" << senf::ClockService::in_microseconds( senf::scheduler::now() - tm.timeout()) << '\n';
+        //std::cerr << "diff:" << senf::ClockService::in_microseconds( senf::scheduler::now() - tm.timeout()) << '\n';
         count ++;
         delay += senf::ClockService::in_microseconds( senf::scheduler::now() - tm.timeout());
         haveCb = true;
@@ -127,10 +127,10 @@ namespace {
     {
         count = 0;
         delay = 0;
-        senf::scheduler::EventHook pre ("jitterTest::preCb", &preCb,
-                                        senf::scheduler::EventHook::PRE);
-        senf::scheduler::EventHook post ("jitterTest::postCb", &postCb,
-                                         senf::scheduler::EventHook::POST);
+//        senf::scheduler::EventHook pre ("jitterTest::preCb", &preCb,
+//                                        senf::scheduler::EventHook::PRE);
+//        senf::scheduler::EventHook post ("jitterTest::postCb", &postCb,
+//                                         senf::scheduler::EventHook::POST);
 
         senf::scheduler::TimerEvent tm1 (
                 "jitterTest::tm1", boost::bind(&jitterCb, boost::ref(tm1)), randomDelay());
@@ -148,7 +148,7 @@ namespace {
 
         senf::scheduler::process();
 
-        std::cerr << "Average scheduling delay: " << delay/count << "\n";
+        std::cerr << "Average scheduling delay: " << delay/count << " microseconds\n";
     }
 
 }