GrPPI  0.2
Generic and Reusable Parallel Pattern Interface
poly/pipeline.h
Go to the documentation of this file.
1 
21 #ifndef GRPPI_POLY_PIPELINE_H
22 #define GRPPI_POLY_PIPELINE_H
23 
24 #include "polymorphic_execution.h"
25 #include "../common/support.h"
26 
27 namespace grppi {
28 
29 template <typename Execution, typename Transformer,
30  typename ... MoreTransformers,
31  requires_arguments<Transformer> = 0>
32 pipeline_info<Execution,Transformer,MoreTransformers...>
33 transform_pipeline(Execution & ex, std::tuple<Transformer, MoreTransformers ...> && transform_ops)
34 {
35  return pipeline_info<Execution,Transformer, MoreTransformers...> (ex,std::forward<std::tuple<Transformer,MoreTransformers...>>(transform_ops));
36 }
37 
38 
39 
40 
41 template <typename Generator, typename ... Transformers>
43  Transformers && ...)
44 {
45 
46 }
47 
48 template <typename E, typename ... O,
49  typename Generator, typename ... Transformers,
51 void pipeline_multi_impl(polymorphic_execution & ex, Generator && generate_op,
52  Transformers && ... transform_ops)
53 {
54  pipeline_multi_impl<O...>(ex, std::forward<Generator>(generate_op),
55  std::forward<Transformers>(transform_ops) ...);
56 }
57 
58 template <typename E, typename ... O,
59  typename Generator, typename ... Transformers,
61 void pipeline_multi_impl(polymorphic_execution & ex, Generator && generate_op,
62  Transformers && ... transform_ops)
63 {
64  if (typeid(E) == ex.type()) {
65  pipeline(*ex.execution_ptr<E>(),
66  std::forward<Generator>(generate_op),
67  std::forward<Transformers>(transform_ops)...);
68  }
69  else {
70  pipeline_multi_impl<O...>(ex, std::forward<Generator>(generate_op),
71  std::forward<Transformers>(transform_ops)...);
72  }
73 }
74 
92 template <typename Generator, typename ... Transformers,
94 void pipeline(polymorphic_execution & ex, Generator && generate_op,
95  Transformers && ... transform_ops)
96 {
102  >(ex, std::forward<Generator>(generate_op),
103  std::forward<Transformers>(transform_ops) ...);
104 }
105 
111 } // end namespace grppi
112 
113 #endif
Definition: callable_traits.h:24
Definition: patterns.h:29
typename std::enable_if_t<!internal::has_arguments< F >(), int > requires_no_arguments
Definition: callable_traits.h:86
pipeline_info< Execution, Transformer, MoreTransformers... > transform_pipeline(Execution &ex, std::tuple< Transformer, MoreTransformers... > &&transform_ops)
Definition: poly/pipeline.h:33
Native parallel execution policy. This policy uses ISO C++ threads as implementation building block a...
Definition: parallel_execution_native.h:136
const std::type_info & type() const noexcept
Definition: polymorphic_execution.h:77
void pipeline(parallel_execution_native &ex, Generator &&generate_op, Transformers &&...transform_ops)
Invoke Pipeline pattern on a data stream with native parallel execution.
Definition: native/pipeline.h:500
std::enable_if_t< is_supported< E >(), int > requires_execution_supported
Definition: support.h:32
OpenMP parallel execution policy.
Definition: parallel_execution_omp.h:40
TBB parallel execution policy.
Definition: parallel_execution_tbb.h:37
E * execution_ptr()
Get the execution pointer for a given type.
Definition: polymorphic_execution.h:91
Sequential execution policy.
Definition: sequential_execution.h:31
Definition: polymorphic_execution.h:63
std::enable_if_t<!is_supported< E >(), int > requires_execution_not_supported
Definition: support.h:36
void pipeline_multi_impl(polymorphic_execution &, Generator &&, Transformers &&...)
Definition: poly/pipeline.h:42