joboccara/pipes

Create a single pipe for multiple data

Opened this issue · 0 comments

I'm trying to produce a pipeline that will operate on multiple data sets.
For example I have a container that contains two vectors. One for rectangles and one for trapezoids.

I can now create a pipeline that operates on just the rectangles and another to operates on the trapezoids.
This method will work but the pipeline needs to be coded twice with the risk of errors.

Would it be possible to define the pipeline just once but iterate over each of the individual entries of both vectors.
So conceptualy something like this:
`
struct Container
{
std::vector rects;
std:vector traps;
};

Container inputs;
Container output;
inputs >>= pipes::transform(scale)
>>= pipes::transform(mirror)
>>= pipes::transform(clip)
>>= pipes::push_back(output);
`
It would also be very nice if the pipeline could change over from one shape type to another.
For example a trapezoid could morph into a rectangle after a certain operation.