20 #ifndef __TPIE_PIPELINING_STD_GLUE_H__
21 #define __TPIE_PIPELINING_STD_GLUE_H__
25 #include <tpie/pipelining/node.h>
26 #include <tpie/pipelining/pipe_base.h>
27 #include <tpie/pipelining/factory_helpers.h>
31 namespace pipelining {
35 template <
typename dest_t,
typename T,
typename A>
40 input_vector_t(dest_t dest,
const std::vector<T, A> & input) : dest(std::move(dest)), input(input) {
47 forward(
"items", static_cast<stream_size_type>(input.size()));
52 for (
auto & i: input) {
59 const std::vector<T, A> & input;
62 template <
typename T,
typename A>
72 forward(
"items", static_cast<stream_size_type>(input.size()));
76 bool can_pull()
const {
return idx < input.size();}
77 const T & peek()
const {
return input[idx];}
78 const T & pull() {
return input[idx++];}
82 const std::vector<T, A> & input;
86 template <
typename T,
typename A>
95 void push(
const T & item) {
96 output.push_back(item);
99 std::vector<item_type, A> & output;
103 template <
typename F>
106 template <
typename dest_t>
109 typedef typename F::argument_type item_type;
111 type(dest_t dest,
const F & f): f(f), dest(std::move(dest)) {
114 void push(
const item_type & item) {
123 template <
typename F>
126 template <
typename dest_t>
129 typedef typename F::argument_type item_type;
131 type(dest_t dest,
const F & f): f(f), dest(std::move(dest)) {
134 void push(
const item_type & item) {
135 typename F::result_type t=f(item);
136 if (t.second) dest.push(t.first);
152 template<
typename T,
typename A>
156 template<
typename T,
typename A>
157 pipe_begin<tfactory<bits::input_vector_t, Args<T, A>,
const std::vector<T, A> &> >
input_vector(std::vector<T, A> &&
input) =
delete;
164 template<
typename T,
typename A>
168 template<
typename T,
typename A>
169 pullpipe_begin<termfactory<bits::pull_input_vector_t<T, A>,
const std::vector<T, A> &> >
pull_input_vector(std::vector<T, A> &&
input) =
delete;
175 template <
typename T,
typename A>
179 template <
typename T,
typename A>
180 pipe_end<termfactory<bits::output_vector_t<T, A>, std::vector<T, A> &> >
output_vector(std::vector<T, A> &&
output) =
delete;
188 template <
typename F>
202 template <
typename F>
pipe_begin< factory< bits::input_t, file_stream< T > &, stream_options > > input(file_stream< T > &fs, stream_options options=stream_options())
Pipelining nodes that pushes the contents of the given file stream to the next node in the pipeline...
void add_push_destination(const node_token &dest)
Called by implementers to declare a push destination.
Node factory for variadic argument templated generators.
pipe_middle< tempfactory< bits::exclude_lambda_t< F >, F > > exclude_lambda(const F &f)
Pipelining nodes that applies to given functor to items in the stream.
void forward(std::string key, T value, memory_size_type k=std::numeric_limits< memory_size_type >::max())
Called by implementers to forward auxiliary data to successors.
Node factory for variadic argument terminators.
pullpipe_begin< termfactory< bits::pull_input_vector_t< T, A >, const std::vector< T, A > & > > pull_input_vector(const std::vector< T, A > &input)
Pipelining nodes that pushes the contents of the given vector to the next node in the pipeline...
pipe_middle< tempfactory< bits::lambda_t< F >, F > > lambda(const F &f)
Pipelining nodes that applies to given functor to items in the stream.
void step(stream_size_type steps=1)
Step the progress indicator.
A pipe_middle class pushes input down the pipeline.
pipe_end< termfactory< bits::output_t< T >, file_stream< T > & > > output(file_stream< T > &fs)
A pipelining node that writes the pushed items to a file stream.
pipe_end< termfactory< bits::output_vector_t< T, A >, std::vector< T, A > & > > output_vector(std::vector< T, A > &output)
Pipelining node that pushes items to the given vector.
void set_steps(stream_size_type steps)
Called by implementers that intend to call step().
pipe_begin< tfactory< bits::input_vector_t, Args< T, A >, const std::vector< T, A > & > > input_vector(const std::vector< T, A > &input)
Pipelining nodes that pushes the contents of the given vector to the next node in the pipeline...