20 #ifndef TPIE_PIPELINING_SPLIT_H
21 #define TPIE_PIPELINING_SPLIT_H
23 #include <tpie/pipelining/node.h>
24 #include <tpie/pipelining/factory_helpers.h>
25 #include <tpie/pipelining/pipe_base.h>
28 namespace pipelining {
47 virtual void push(
const T & v) = 0;
53 template <
typename dest_t>
57 : the_sources(the_sources)
58 , dest(std::move(dest))
60 this->
set_name(
"Split source", PRIORITY_INSIGNIFICANT);
64 bits::node_map::ptr m = this->
get_node_map()->find_authority();
65 m->add_relation(sink_token.id(), this->
get_token().id(), bits::pushes);
71 the_sources.push_back(
this);
74 virtual void push(
const T & v)
override {
79 std::vector<source_base *> & the_sources;
83 pipe_begin<factory<source_impl, node_token, std::vector<source_base *> &> > source() {
84 return {sink_token, the_sources};
92 :
node(sink_token), the_sources(the_sources)
94 set_name(
"Join sink", PRIORITY_INSIGNIFICANT);
97 void push(
const T & v) {
98 for (
auto & source : the_sources)
103 std::vector<source_base *> & the_sources;
107 return {sink_token, the_sources};
111 std::vector<source_base *> the_sources;
112 node_token sink_token;
118 #endif // TPIE_PIPELINING_SPLIT_H
bits::node_map::ptr get_node_map() const
Get the local node map, mapping node IDs to node pointers for all the nodes reachable from this one...
const node_token & get_token() const
Get the node_token that maps this node's ID to a pointer to this.
void add_push_destination(const node_token &dest)
Called by implementers to declare a push destination.
Split one push streams into multiple.
void set_name(const std::string &name, priority_type priority=PRIORITY_USER)
Set this node's name.
virtual void prepare() override
Called before memory assignment but after depending phases have executed and ended.
node()
Default constructor, using a new node_token.