20 #ifndef __TPIE_PIPELINING_PIPE_BASE_H__
21 #define __TPIE_PIPELINING_PIPE_BASE_H__
24 #include <tpie/pipelining/priority_type.h>
25 #include <tpie/pipelining/pair_factory.h>
26 #include <tpie/pipelining/pipeline.h>
27 #include <tpie/pipelining/node_set.h>
37 #pragma warning(disable: 4521)
42 namespace pipelining {
46 template <
typename child_t>
67 return std::move(
self());
92 child_t
name(
const std::string & n, priority_type p = PRIORITY_USER) {
94 return std::move(
self());
104 child_t
phase_name(
const std::string & n, priority_type p = PRIORITY_USER) {
106 return std::move(
self());
119 return std::move(
self());
128 self().
factory.add_dependencies(s);
129 return std::move(
self());
138 self().
factory.add_forwarding_dependencies(s);
139 return std::move(
self());
151 return std::move(
self());
155 self().
factory.forward(key, std::move(value));
156 return std::move(
self());
159 template <
typename T>
160 child_t forward(
const std::string & key, T value) {
165 inline child_t &
self() {
return *
static_cast<child_t*
>(
this);}
166 inline const child_t &
self()
const {
return *
static_cast<const child_t*
>(
this);}
174 template <
typename child_t,
typename fact_t>
177 typedef typename fact_t::constructed_type constructed_type;
179 constructed_type construct() {
180 return this->
self().
factory.construct();
187 template <
typename child_t>
196 template <
typename dest_t>
198 typedef typename child_t::factory_type::template constructed<dest_t>::type type;
201 template <
typename dest_t>
202 typename constructed<dest_t>::type construct(
const dest_t & dest) {
203 return this->
self().
factory.construct(dest);
209 template <
typename fact_t>
212 typedef fact_t factory_type;
223 template <
typename ... T_ARGS>
230 class empty_pipe_middle;
240 template <
typename fact_t>
243 typedef fact_t factory_type;
268 template <
typename ... T_ARGS>
274 template <
typename fact2_t>
290 template <
typename fact2_t>
316 template <
typename fact_t>
323 template <
typename fact_t>
328 template <
typename fact_t>
338 typedef fact_t factory_type;
356 template <
typename ... T_ARGS>
360 template <
typename fact2_t>
367 pipe_begin operator|(empty_pipe_middle &&) {
return pipe_begin(std::move(factory));}
369 template <
typename fact2_t>
370 bits::pipeline_impl<bits::termpair_factory<fact_t, fact2_t> >
371 operator|(pipe_end<fact2_t> && r) {
372 factory.set_destination_kind_push();
373 return bits::termpair_factory<fact_t, fact2_t>(std::move(factory), std::move(r.factory)).finalize();
379 template <
typename fact_t>
382 typedef fact_t factory_type;
395 template <
typename ... T_ARGS>
401 template <
typename fact_t>
404 typedef fact_t factory_type;
417 template <
typename ... T_ARGS>
420 template <
typename fact2_t>
423 fact2_t f = std::move(r.factory);
424 f.set_destination_kind_pull();
428 template <
typename fact2_t>
429 pullpipe_end<bits::termpair_factory<fact2_t, fact_t> >
430 operator|(pipe_end<fact2_t> && r) {
431 fact2_t f = std::move(r.factory);
432 f.set_destination_kind_pull();
433 return bits::termpair_factory<fact2_t, fact_t>(std::move(f), std::move(factory));
439 template <
typename fact_t>
442 typedef fact_t factory_type;
455 template <
typename ... T_ARGS>
458 template <
typename fact2_t>
461 fact2_t f = std::move(r.factory);
462 f.set_destination_kind_pull();
466 template <
typename fact2_t>
467 bits::pipeline_impl<bits::termpair_factory<fact2_t, fact_t> >
468 operator|(pullpipe_end<fact2_t> && r) {
469 fact2_t f = std::move(r.factory);
470 f.set_destination_kind_pull();
471 return bits::termpair_factory<fact2_t, fact_t>(std::move(f), std::move(factory)).finalize();
485 #endif // __TPIE_PIPELINING_PIPE_BASE_H__
void set_destination_kind_push()
Used by pipe_base classes to indicate that the default actor edge is a push edge. ...
pullpipe_middle(T_ARGS &&...t)
Forwards the arguments given to the constructor of the factory.
double memory() const
Get memory fraction for this node in the pipeline phase.
void memory(double amount)
Set memory fraction for this node in the pipeline phase.
child_t memory(double amount)
Set memory fraction for this node in the pipeline phase.
A empty_pipe_middle class has no effect.
void phase_name(const std::string &n, priority_type p)
Set name for this phase.
pipe_end< bits::termpair_factory< fact_t, fact2_t > > operator|(pipe_end< fact2_t > &&r)
This pipe operator combines this generator/filter with a terminator to make a pipeline.
pipe_end< fact_t > operator|(pipe_end< fact_t > &&r) const
This pipe operator combines this generator/filter with a terminator to make a pipeline.
child_t name(const std::string &n, priority_type p=PRIORITY_USER)
Set name for this node.
pipe_middle< fact_t > operator|(pipe_middle< fact_t > &&r) const
The pipe operator combines this generator/filter with another filter.
pipe_end(T_ARGS &&...t)
Forwards the arguments given to the constructor of the factory.
pullpipe_begin(T_ARGS &&...t)
Forwards the arguments given to the constructor of the factory.
child_t add_forwarding_dependencies(node_set s)
Add a forwarding dependency to a referenced node.
pipe_middle< bits::pair_factory< fact_t, fact2_t > > operator|(pipe_middle< fact2_t > &&r)
The pipe operator combines this generator/filter with another filter.
void name(const std::string &n, priority_type p)
Set name for this node.
pipe_middle operator|(empty_pipe_middle &&)
The pipe operator combines this generator/filter with another filter.
child_t phase_name(const std::string &n, priority_type p=PRIORITY_USER)
Set name for this phase.
child_t add_dependencies(node_set s)
Add a depencency to a referenced node.
child_t breadcrumb(const std::string &n)
Set a prefix for the name of this node.
pipe_middle(T_ARGS &&...t)
Forwards the arguments given to the constructor of the factory.
pipe_begin(T_ARGS &&...t)
Forwards the arguments given to the constructor of the factory.
Node factory for variadic argument generators.
child_t add_to_set(node_set s)
Get a refenerce to this node.
A pipe_middle class pushes input down the pipeline.
pullpipe_end(T_ARGS &&...t)
Forwards the arguments given to the constructor of the factory.
void push_breadcrumb(const std::string &n)
Set a prefix for the name of this node.