From: dw6 Date: Wed, 9 Apr 2008 17:07:39 +0000 (+0000) Subject: major bugs fixed :-) X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=7527fa188b41bd1e1ce1eb55777bfe360eb8373e;p=senf.git major bugs fixed :-) git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@796 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/PPI/ForwardSwitch.cci b/PPI/ForwardSwitch.cci index c292dcc..7b8012a 100644 --- a/PPI/ForwardSwitch.cci +++ b/PPI/ForwardSwitch.cci @@ -20,30 +20,37 @@ #include "ForwardSwitch.hh" -#define prefix_ +#define prefix_ inline -prefix_ ForwardSwitch::ForwardSwitch(bool state) +prefix_ senf::ppi::module::ForwardSwitch::ForwardSwitch(bool state) { route( input, output ); input.onRequest( &ForwardSwitch::onRequest ); forward_ = state; } -prefix_ bool ForwardSwitch::forward(){ +prefix_ void senf::ppi::module::ForwardSwitch::onRequest() +{ + if(forward_){ + output(input()); + } +} + +prefix_ bool senf::ppi::module::ForwardSwitch::forward(){ return forward_; } -prefix_ bool ForwardSwitch::forward(bool state){ +prefix_ bool senf::ppi::module::ForwardSwitch::forward(bool state){ forward_ = state; return state; } -prefix_ void ForwardSwitch::stopForwarding(){ +prefix_ bool senf::ppi::module::ForwardSwitch::stopForwarding(){ return forward(false); } -prefix_ void ForwardSwitch::startForwarding(){ +prefix_ bool senf::ppi::module::ForwardSwitch::startForwarding(){ return forward(true); } diff --git a/PPI/ForwardSwitch.hh b/PPI/ForwardSwitch.hh index 4d21415..92bd13a 100644 --- a/PPI/ForwardSwitch.hh +++ b/PPI/ForwardSwitch.hh @@ -35,18 +35,20 @@ class ForwardSwitch SENF_PPI_MODULE(ForwardSwitch); public: - connector::ActiveInput<> input; + connector::PassiveInput<> input; connector::ActiveOutput<> output; ForwardSwitch(bool state); private: + void onRequest(); bool forward_; bool forward(); bool forward(bool state); - void stopForwarding(); - void startForwarding(); + bool stopForwarding(); + bool startForwarding(); }; }}} //namespaces +#include "ForwardSwitch.cci" #endif /*FORWARDSWITCH_HH_*/