![]() |
Home | Libraries | People | FAQ | More |
The Signal Network library was built with push-based networks in mind (the data producer sends data through a signal), but it can also be used for pull-based networks (the data consumer requests data through a signal).
The following example illustrates this:
Table 1.7. pull-based network example
|
fused |
unfused |
|---|---|
|
|
signals::storage<void(float), signals::unfused> generator(1.0f); PullDoubler doubler; doubler >>= generator.value_at_slot<0>(); BOOST_CHECK(doubler() == 2.0f);
|
The example uses the following classes:
class PullDoubler : public signals::filter<float (), signals::unfused> { public: float operator()() { return 2*out(); } };
| Copyright © 2007 Stjepan Rajko |