Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 20

Pipeline filter: Style

$
0
0

Dear all,

I have a simple pipeline that should be constructed invoking some class methods. This is done because I'm using those methods serially for debugging purposes, but the style I'm using is horrible: having lambda wrappers:

    auto readerfn = [&](tbb::flow_control &flow)
    {
        return reader(flow);
    };

    auto correctorfn = [&](std::string s)
    {
        return corrector(s);
    };

    auto writerfn = [&](bool b)
    {
        writer(b);
    };

    // Start the pipeline
    tbb::parallel_pipeline(tokens,
                           tbb::make_filter<void, std::string>(tbb::filter::serial, readerfn) &
                           tbb::make_filter<std::string, bool>(tbb::filter::parallel, correctorfn) &
                           tbb::make_filter<bool, void>(tbb::filter::serial, writerfn));

Can you suggest a more acceptable way of making this thing work serially (not using the pipeline), and in parallel?

Thanks & Cheers!


Viewing all articles
Browse latest Browse all 20

Trending Articles