Stjepan Rajko | 4 Sep 09:06
Favicon

[dataflow][review] facilities for creating generic components

Hello,

I updated the Dataflow documentation with some examples showing how to
create generic (in the sense that they can be used with a number of
signal signatures) components for Dataflow.Signals with the help of
some provided class templates.  These class templates are applicator,
conditional, instantiator, and modifier (there is also a
conditional_modifier which is not documented, but it basically
provides functionality of both conditional and modifier).  The updated
docs (with examples) are uploaded to:

http://www.dancinghacker.com/code/dataflow/

You will find the mentioned class templates in the Components
subsection of the Dataflow.Signals section.

For example, the modifier documentation shows how to easily build a
generic multiplier component, which will multiply each argument of the
passing signal by a specified factor.  The component could then be
used as follows:

{
    signals::storage<void (int, double)> result;
    multiplier<void (int, double)> multiply_by_3 (3);

    // result will store the result of the multiplication
    multiply_by_3 >>= result;
    multiply_by_3(1, 1.5);

    BOOST_ASSERT(result.at<0>() == 3);
(Continue reading)


Gmane