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>
38 typedef typename dest_t::item_type item_type;
40 inline input_vector_t(
const dest_t & dest,
const std::vector<item_type> & input) : dest(dest), input(input) {
42 set_name(
"Read", PRIORITY_INSIGNIFICANT);
46 forward(
"items", static_cast<stream_size_type>(input.size()));
50 virtual void go()
override {
51 typedef typename std::vector<item_type>::const_iterator IT;
52 for (IT i = input.begin(); i != input.end(); ++i) {
59 const std::vector<item_type> & input;
68 set_name(
"Write", PRIORITY_INSIGNIFICANT);
71 inline void push(
const T & item) {
72 output.push_back(item);
75 std::vector<item_type> & output;
81 template <
typename dest_t>
84 typedef typename F::argument_type item_type;
86 type(
const dest_t & dest,
const F & f): f(f), dest(dest) {
87 set_name(
"Lambda", PRIORITY_INSIGNIFICANT);
90 void push(
const item_type & item) {
102 template <
typename dest_t>
105 typedef typename F::argument_type item_type;
107 type(
const dest_t & dest,
const F & f): f(f), dest(dest) {
108 set_name(
"Lambda", PRIORITY_INSIGNIFICANT);
111 void push(
const item_type & item) {
112 typename F::result_type t=f(item);
113 if (t.second) dest.push(t.first);
129 template <
typename T>
130 inline pipe_end<termfactory_1<bits::output_vector_t<T>, std::vector<T> &> > output_vector(std::vector<T> & output) {
131 return termfactory_1<bits::output_vector_t<T>, std::vector<T> &>(output);
134 template <
typename F>
135 inline pipe_middle<tempfactory_1<bits::lambda_t<F>, F> > lambda(
const F & f) {
136 return tempfactory_1<bits::lambda_t<F>, F>(f);
139 template <
typename F>
140 inline pipe_middle<tempfactory_1<bits::exclude_lambda_t<F>, F> > exclude_lambda(
const F & f) {
141 return tempfactory_1<bits::exclude_lambda_t<F>, F>(f);
void add_push_destination(const node_token &dest)
Called by implementers to declare a push destination.
void set_name(const std::string &name, priority_type priority=PRIORITY_USER)
Set this node's name.
Node factory for 1-argument generator.
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().
void forward(std::string key, T value, bool explicitForward=true)
Called by implementers to forward auxiliary data to successors.