From: dw6 Date: Sun, 13 Apr 2008 06:59:51 +0000 (+0000) Subject: completing ForwardSwitch X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=61bbb1c1ec66b1a41951fc971d0325095e17e7a9;p=senf.git completing ForwardSwitch git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@809 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/PPI/ForwardSwitch.cci b/PPI/ForwardSwitch.cci index 7b8012a..de3874d 100644 --- a/PPI/ForwardSwitch.cci +++ b/PPI/ForwardSwitch.cci @@ -23,17 +23,19 @@ #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(){