completing ForwardSwitch
dw6 [Sun, 13 Apr 2008 06:59:51 +0000 (06:59 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@809 270642c3-0616-0410-b53a-bc976706d245

PPI/ForwardSwitch.cci

index 7b8012a..de3874d 100644 (file)
 #define prefix_ inline
 
 prefix_  senf::ppi::module::ForwardSwitch::ForwardSwitch(bool state) 
+    :forward_(state)
 {
     route( input, output );
     input.onRequest( &ForwardSwitch::onRequest );
-    forward_ = state;
 }
 
 prefix_  void senf::ppi::module::ForwardSwitch::onRequest() 
 {
-       if(forward_){
-               output(input());
-       }
+    if(forward_){
+        output.write(input.read());
+    } else {
+        input.read(); // and discard automatically
+    }
 }
 
 prefix_ bool  senf::ppi::module::ForwardSwitch::forward(){