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>
32 template <
typename dest_t,
typename T,
typename A>
44 forward(
"items",
static_cast<stream_size_type
>(
input.size()));
49 for (
auto & i:
input) {
56 const std::vector<T, A> &
input;
59 template <
typename T,
typename A>
69 forward(
"items",
static_cast<stream_size_type
>(
input.size()));
73 bool can_pull()
const {
return idx <
input.size();}
74 const T & peek()
const {
return input[idx];}
75 const T & pull() {
return input[idx++];}
79 const std::vector<T, A> & input;
83 template <
typename T,
typename A>
92 void push(
const T & item) {
96 std::vector<item_type, A> &
output;
100 template <
typename dest_t,
typename F>
103 typedef typename F::argument_type item_type;
105 lambda_t(dest_t dest,
const F & f): f(f), dest(std::move(dest)) {
108 void push(
const item_type & item) {
116 template <
typename dest_t,
typename F>
119 typedef typename F::argument_type item_type;
124 void push(
const item_type & item) {
125 typename F::result_type t=f(item);
126 if (t.second) dest.push(t.first);
141 template<
typename T,
typename A>
145 template<
typename T,
typename A>
146 pipe_begin<tfactory<bits::input_vector_t, Args<T, A>,
const std::vector<T, A> &> >
input_vector(std::vector<T, A> &&
input) =
delete;
153 template<
typename T,
typename A>
157 template<
typename T,
typename A>
158 pullpipe_begin<termfactory<bits::pull_input_vector_t<T, A>,
const std::vector<T, A> &> >
pull_input_vector(std::vector<T, A> &&
input) =
delete;
164 template <
typename T,
typename A>
168 template <
typename T,
typename A>
169 pipe_end<termfactory<bits::output_vector_t<T, A>, std::vector<T, A> &> >
output_vector(std::vector<T, A> &&
output) =
delete;
177 template <
typename F>
191 template <
typename F>
198 #endif //__TPIE_PIPELINING_STD_GLUE_H__
pipelining/factory_base.h Base class of pipelining factories
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_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.
pipe_middle< tfactory< bits::lambda_t, Args< F >, F > > lambda(const F &f)
Pipelining nodes that applies to given functor to items in the stream.
pipe_middle< tfactory< bits::exclude_lambda_t, Args< 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.
void add_push_destination(const node_token &dest)
Called by implementers to declare a push destination.
void step(stream_size_type steps=1)
Step the progress indicator.
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.
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.
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.