docs/classtf_1_1DataPipe.html
| | Taskflow: A General-purpose Task-parallel Programming System |
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
tf::DataPipe< Input, Output, C > Class Template Reference
class to create a stage in a data-parallel pipeline More...
#include <taskflow/algorithm/data_pipeline.hpp>
|
|
| 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
|
| |
|
|
| | DataPipe ()=default |
| | default constructor
|
| |
| | DataPipe (PipeType d, callable_t &&callable) |
| | constructs a data pipe
|
| |
| PipeType | type () const |
| | queries the type of the data pipe
|
| |
| void | type (PipeType type) |
| | assigns a new type to the data pipe
|
| |
| template<typename U> |
| void | callable (U &&callable) |
| | assigns a new callable to the data pipe
|
| |
|
| | template<typename... Ps> | | class | DataPipeline | | |
template<typename Input, typename Output, typename C>
class tf::DataPipe< Input, Output, C >
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::PipeType) and is associated with a callable to invoke by the pipeline scheduler.
You need to use the template function, tf::make_data_pipe, to create a data pipe. The input and output types of a tf::DataPipe should be decayed types (though the library will always decay them for you using std::decay) 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>(
[](int& input) {return std::to_string(input + 100);}
);
auto make_data_pipe(PipeType d, C &&callable)
function to construct a data pipe (tf::DataPipe)
Definition data_pipeline.hpp:171
@ SERIAL
serial type
Definition pipeline.hpp:117
In addition to the data, you callable can take an additional reference of tf::Pipeflow in the second argument to probe the runtime information for a stage task, such as its line number and token number:
tf::make_data_pipe<int, std::string>(
[](int& input, tf::Pipeflow& pf) {
printf("token=%lu, line=%lu\n", pf.token(), pf.line());
return std::to_string(input + 100);
}
);
class to create a pipeflow object used by the pipe callable
Definition pipeline.hpp:43
size_t token() const
queries the token identifier
Definition pipeline.hpp:78
size_t line() const
queries the line identifier of the present token
Definition pipeline.hpp:64
template<typename Input, typename Output, typename C>
|
| tf::DataPipe< Input, Output, C >::DataPipe | ( | PipeType | d, | | | | callable_t && | callable ) |
| inline |
constructs a data pipe
You should use the helper function, tf::make_data_pipe, to create a DataPipe object, especially when you need tf::DataPipe to automatically deduct the lambda type.
template<typename Input, typename Output, typename C>
template<typename U>
|
| void tf::DataPipe< Input, Output, C >::callable | ( | U && | callable | ) | |
| inline |
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.
template<typename Input, typename Output, typename C>
|
| PipeType tf::DataPipe< Input, Output, C >::type | ( | | ) | const |
| inline |
queries the type of the data pipe
A data pipe can be either parallel (tf::PipeType::PARALLEL) or serial (tf::PipeType::SERIAL).
The documentation for this class was generated from the following file:
taskflow/algorithm/data_pipeline.hpp
Maintained by Dr. Tsung-Wei Huang — Generated by 1.13.1