20 #ifndef __TPIE_PIPELINING_PIPELINE_H__
21 #define __TPIE_PIPELINING_PIPELINE_H__
23 #include <tpie/tpie_export.h>
28 #include <tpie/file_manager.h>
30 #include <unordered_set>
64 void plot(std::ostream & out) {plot_impl(out,
false);}
76 void plot_full(std::ostream & out) {plot_impl(out,
true);}
85 bool can_fetch(std::string key);
89 node_map::ptr get_node_map()
const {
93 void output_memory(std::ostream & o)
const;
95 size_t uid()
const {
return m_uid;};
98 node_map::ptr m_nodeMap;
101 void plot_impl(std::ostream & out,
bool full);
115 memory_size_type filesAvailable, memory_size_type mem,
116 const char *
file,
const char *
function);
123 memory_size_type mem,
124 const char *
file,
const char *
function) {
128 double memory()
const {
132 void order_before(pipeline_base & other);
142 template <
typename fact_t>
145 typedef typename fact_t::constructed_type gen_t;
150 auto n = std::unique_ptr<gen_t>(
new gen_t(
factory.construct()));
151 this->m_nodeMap = n->get_node_map()->find_authority();
152 this->m_nodeMap->increment_pipeline_ref();
153 this->m_nodeMap->add_owned_node(std::move(n));
163 if (this->m_nodeMap) {
164 this->m_nodeMap->find_authority()->decrement_pipeline_ref();
172 TPIE_EXPORT
extern std::unordered_set<bits::pipeline_base_base *> current_pipelines;
173 TPIE_EXPORT
extern std::mutex current_pipelines_mutex;
189 template <
typename T>
191 *
this = std::move(from);
194 template <
typename T>
196 p.reset(
new T(std::move(from)));
200 pipeline(
const std::shared_ptr<bits::pipeline_base> & p): p(p) {}
208 const char *
file,
const char *
function) {
213 memory_size_type mem,
214 const char *
file,
const char *
function) {
219 memory_size_type filesAvailable, memory_size_type mem,
220 const char *
file,
const char *
function) {
221 (*p)(items, pi, filesAvailable, mem,
file,
function);
224 void plot(std::ostream & os = std::cout) {
228 void plot_full(std::ostream & os = std::cout) {
232 inline double memory()
const {
236 bits::node_map::ptr get_node_map()
const {
237 return p->get_node_map();
240 bool can_fetch(std::string key) {
241 return p->can_fetch(key);
245 return p->fetch_any(key);
248 template <
typename T>
249 T & fetch(std::string key) {
251 return any_cast<T>(a);
255 p->forward_any(key, std::move(value));
258 template <
typename T>
259 void forward(std::string key, T value) {
264 p->order_before(*other.p);
268 void output_memory(std::ostream & o)
const {p->output_memory(o);}
270 std::shared_ptr<bits::pipeline_base> p;
275 #endif // __TPIE_PIPELINING_PIPELINE_H__