template<typename Input, typename Output, typename C>
DataPipe class
class to create a stage in a data-parallel pipeline
A data pipe represents a stage of a data-parallel pipeline. A data pipe can be either parallel direction or serial direction (specified by tf::
You need to use the template function, tf::std::
) to allow internal storage to work. The data will be passed by reference to your callable, at which you can take it by copy or reference.
tf::make_data_pipe<int, std::string>( tf::PipeType::SERIAL, [](int& input) {return std::to_string(input + 100);} );
In addition to the data, you callable can take an additional reference of tf::
tf::make_data_pipe<int, std::string>( tf::PipeType::SERIAL, [](int& input, tf::Pipeflow& pf) { printf("token=%lu, line=%lu\n", pf.token(), pf.line()); return std::to_string(input + 100); } );
Public types
- using callable_t = C
- callable type of the data pipe
- using input_t = Input
- input type of the data pipe
- using output_t = Output
- output type of the data pipe
Constructors, destructors, conversion operators
- DataPipe() defaulted
- default constructor
-
DataPipe(PipeType d,
callable_
t&& callable) - constructs a data pipe
Public functions
Function documentation
template<typename Input, typename Output, typename C>
tf:: DataPipe<Input, Output, C>:: DataPipe(PipeType d,
callable_ t&& callable)
constructs a data pipe
You should use the helper function, tf::
template<typename Input, typename Output, typename C>
PipeType tf:: DataPipe<Input, Output, C>:: type() const
queries the type of the data pipe
A data pipe can be either parallel (tf::
template<typename Input, typename Output, typename C>
template<typename U>
void tf:: DataPipe<Input, Output, C>:: callable(U&& callable)
assigns a new callable to the data pipe
Template parameters | |
---|---|
U | callable type |
Parameters | |
callable | a callable object constructible from the callable type of this data pipe |
Assigns a new callable to the pipe using universal forwarding.