![]() |
Home | Libraries | People | FAQ | More |
Chaining of components can be done using operator
>>=.
Table 1.5. chaining example
|
fused |
unfused |
|---|---|
|
// instantiate all of the components we need signals::storage<void (), signals::fused> banger; signals::storage<void (float), signals::fused> floater(2.5f); signals::storage<void (float), signals::fused> collector(0.0f); // create the network (banger to floater.send, floater to collector) banger >>= floater.send_slot() >>= collector; // signal from banger causes floater to output 2.5 banger(); BOOST_CHECK_EQUAL(collector.at<0>(), 2.5f); // change the value in floater floater(1.5f); floater.send(); // we can also signal floater directly BOOST_CHECK_EQUAL(collector.at<0>(), 1.5f);
|
// instantiate all of the components we need signals::storage<void (), signals::unfused> banger; signals::storage<void (float), signals::unfused> floater(2.5f); signals::storage<void (float), signals::unfused> collector(0.0f); // create the network (banger to floater.send, floater to collector) banger >>= floater.send_slot() >>= collector; // signal from banger causes floater to output 2.5 banger(); BOOST_CHECK_EQUAL(floater.at<0>(), 2.5f); BOOST_CHECK_EQUAL(collector.at<0>(), 2.5f); floater(1.5f); // change the value in floater floater.send(); // we can also signal floater directly BOOST_CHECK_EQUAL(collector.at<0>(), 1.5f);
|
| Copyright © 2007 Stjepan Rajko |