Compare commits

...
Author SHA1 Message Date
Mishin, Ilya eb4d20fd9c remove unnecessary alias
Signed-off-by: Mishin, Ilya <ilya.mishin@intel.com>
2021-06-09 11:40:11 +03:00
Mishin, Ilya 2c83c1fc53 make new types private
Signed-off-by: Mishin, Ilya <ilya.mishin@intel.com>
2021-06-08 17:59:42 +03:00
Mishin, Ilya 68e0f7f6fd empty base class 2021-06-08 17:38:04 +03:00
Mishin, Ilya 0ad6d66323 new on right type
Signed-off-by: Mishin, Ilya <ilya.mishin@intel.com>
2021-06-08 16:59:58 +03:00
Mishin, Ilya 08ebe31d57 remove redefinition
Signed-off-by: Mishin, Ilya <ilya.mishin@intel.com>
2021-06-08 16:43:02 +03:00
Mishin, Ilya e54de9ccef move structures
Signed-off-by: Mishin, Ilya <ilya.mishin@intel.com>
2021-06-08 16:36:10 +03:00
Mishin, Ilya 01e4ebbfe6 rewrite implementation of join_node
Signed-off-by: Mishin, Ilya <ilya.mishin@intel.com>
2021-06-08 16:17:39 +03:00
3 changed files with 58 additions and 476 deletions
+51 -469
View File
@@ -1208,495 +1208,77 @@
OutputTuple > type;
};
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
template <typename K, typename T>
struct key_from_message_body {
K operator()(const T& t) const {
return key_from_message<K>(t);
}
};
// Adds const to reference type
template <typename K, typename T>
struct key_from_message_body<K&,T> {
const K& operator()(const T& t) const {
return key_from_message<const K&>(t);
}
};
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
//! unfolded_join_node : passes input_ports_type to join_node_base. We build the input port type
// using tuple_element. The class PT is the port type (reserving_port, queueing_port, key_matching_port)
// and should match the typename.
template<int N, template<class> class PT, typename OutputTuple, typename JP>
class unfolded_join_node : public join_base<N,PT,OutputTuple,JP>::type {
public:
typedef typename wrap_tuple_elements<N, PT, OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
template<template<class> class PT, typename OutputTuple, typename JP>
class unfolded_join_node;
template<template<class> class PT, typename ...Args, typename JP>
class unfolded_join_node<PT, std::tuple<Args...>, JP> : public join_base<sizeof...(Args),PT,std::tuple<Args...>,JP>::type {
private:
typedef join_node_base<JP, input_ports_type, output_type > base_type;
const static std::size_t tuple_size = sizeof...(Args);
public:
using output_type = std::tuple<Args...>;
using input_ports_type = typename wrap_tuple_elements<tuple_size, PT, output_type>::type;
private:
using base_type = join_node_base<JP, input_ports_type, output_type>;
public:
unfolded_join_node(graph &g) : base_type(g) {}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
template <typename K, typename T>
struct key_from_message_body {
K operator()(const T& t) const {
return key_from_message<K>(t);
}
};
// Adds const to reference type
template <typename K, typename T>
struct key_from_message_body<K&,T> {
const K& operator()(const T& t) const {
return key_from_message<const K&>(t);
}
};
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
// key_matching unfolded_join_node. This must be a separate specialization because the constructors
// differ.
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<2,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<2,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
public:
typedef typename wrap_key_tuple_elements<2,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
template<typename ...Args, typename K, typename KHash>
class unfolded_join_node<key_matching_port,std::tuple<Args...>, key_matching<K,KHash>> : public
join_base<sizeof...(Args),key_matching_port,std::tuple<Args...>,key_matching<K,KHash> >::type {
private:
typedef join_node_base<key_matching<K,KHash>, input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef std::tuple< f0_p, f1_p > func_initializer_type;
public:
const static std::size_t tuple_size = sizeof...(Args);
public:
using output_type = std::tuple<Args...>;
using input_ports_type = typename wrap_key_tuple_elements<tuple_size, key_matching_port, key_matching<K,KHash>, output_type>::type;
private:
using base_type = join_node_base<key_matching<K,KHash>, input_ports_type, output_type>;
template <typename T>
using fixed_type_to_key_function_body_ptr = type_to_key_function_body<T, K> *;
using func_initializer_type = std::tuple< fixed_type_to_key_function_body_ptr<Args>... > ;
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
template <typename T>
using fixed_type_to_key_function_body_leaf = type_to_key_function_body_leaf<T, K, key_from_message_body<K,T>>;
public:
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>())
) ) {
new fixed_type_to_key_function_body_leaf<Args>(key_from_message_body<K,Args>())...) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1>
unfolded_join_node(graph &g, Body0 body0, Body1 body1) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 2, "wrong number of body initializers");
public:
template<typename ...BodyArgs>
unfolded_join_node(graph &g, BodyArgs... bodies) : base_type(g,
func_initializer_type( new type_to_key_function_body_leaf<Args, K, BodyArgs>(bodies)...) ) {
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<3,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<3,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
typedef typename std::tuple_element<2, OutputTuple>::type T2;
public:
typedef typename wrap_key_tuple_elements<3,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
private:
typedef join_node_base<key_matching<K,KHash>, input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef type_to_key_function_body<T2, K> *f2_p;
typedef std::tuple< f0_p, f1_p, f2_p > func_initializer_type;
public:
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>()),
new type_to_key_function_body_leaf<T2, K, key_from_message_body<K,T2> >(key_from_message_body<K,T2>())
) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1, typename Body2>
unfolded_join_node(graph &g, Body0 body0, Body1 body1, Body2 body2) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1),
new type_to_key_function_body_leaf<T2, K, Body2>(body2)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 3, "wrong number of body initializers");
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<4,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<4,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
typedef typename std::tuple_element<2, OutputTuple>::type T2;
typedef typename std::tuple_element<3, OutputTuple>::type T3;
public:
typedef typename wrap_key_tuple_elements<4,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
private:
typedef join_node_base<key_matching<K,KHash>, input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef type_to_key_function_body<T2, K> *f2_p;
typedef type_to_key_function_body<T3, K> *f3_p;
typedef std::tuple< f0_p, f1_p, f2_p, f3_p > func_initializer_type;
public:
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>()),
new type_to_key_function_body_leaf<T2, K, key_from_message_body<K,T2> >(key_from_message_body<K,T2>()),
new type_to_key_function_body_leaf<T3, K, key_from_message_body<K,T3> >(key_from_message_body<K,T3>())
) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1, typename Body2, typename Body3>
unfolded_join_node(graph &g, Body0 body0, Body1 body1, Body2 body2, Body3 body3) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1),
new type_to_key_function_body_leaf<T2, K, Body2>(body2),
new type_to_key_function_body_leaf<T3, K, Body3>(body3)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 4, "wrong number of body initializers");
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<5,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<5,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
typedef typename std::tuple_element<2, OutputTuple>::type T2;
typedef typename std::tuple_element<3, OutputTuple>::type T3;
typedef typename std::tuple_element<4, OutputTuple>::type T4;
public:
typedef typename wrap_key_tuple_elements<5,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
private:
typedef join_node_base<key_matching<K,KHash> , input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef type_to_key_function_body<T2, K> *f2_p;
typedef type_to_key_function_body<T3, K> *f3_p;
typedef type_to_key_function_body<T4, K> *f4_p;
typedef std::tuple< f0_p, f1_p, f2_p, f3_p, f4_p > func_initializer_type;
public:
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>()),
new type_to_key_function_body_leaf<T2, K, key_from_message_body<K,T2> >(key_from_message_body<K,T2>()),
new type_to_key_function_body_leaf<T3, K, key_from_message_body<K,T3> >(key_from_message_body<K,T3>()),
new type_to_key_function_body_leaf<T4, K, key_from_message_body<K,T4> >(key_from_message_body<K,T4>())
) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1, typename Body2, typename Body3, typename Body4>
unfolded_join_node(graph &g, Body0 body0, Body1 body1, Body2 body2, Body3 body3, Body4 body4) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1),
new type_to_key_function_body_leaf<T2, K, Body2>(body2),
new type_to_key_function_body_leaf<T3, K, Body3>(body3),
new type_to_key_function_body_leaf<T4, K, Body4>(body4)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 5, "wrong number of body initializers");
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
#if __TBB_VARIADIC_MAX >= 6
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<6,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<6,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
typedef typename std::tuple_element<2, OutputTuple>::type T2;
typedef typename std::tuple_element<3, OutputTuple>::type T3;
typedef typename std::tuple_element<4, OutputTuple>::type T4;
typedef typename std::tuple_element<5, OutputTuple>::type T5;
public:
typedef typename wrap_key_tuple_elements<6,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
private:
typedef join_node_base<key_matching<K,KHash> , input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef type_to_key_function_body<T2, K> *f2_p;
typedef type_to_key_function_body<T3, K> *f3_p;
typedef type_to_key_function_body<T4, K> *f4_p;
typedef type_to_key_function_body<T5, K> *f5_p;
typedef std::tuple< f0_p, f1_p, f2_p, f3_p, f4_p, f5_p > func_initializer_type;
public:
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>()),
new type_to_key_function_body_leaf<T2, K, key_from_message_body<K,T2> >(key_from_message_body<K,T2>()),
new type_to_key_function_body_leaf<T3, K, key_from_message_body<K,T3> >(key_from_message_body<K,T3>()),
new type_to_key_function_body_leaf<T4, K, key_from_message_body<K,T4> >(key_from_message_body<K,T4>()),
new type_to_key_function_body_leaf<T5, K, key_from_message_body<K,T5> >(key_from_message_body<K,T5>())
) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1, typename Body2, typename Body3, typename Body4, typename Body5>
unfolded_join_node(graph &g, Body0 body0, Body1 body1, Body2 body2, Body3 body3, Body4 body4, Body5 body5)
: base_type(g, func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1),
new type_to_key_function_body_leaf<T2, K, Body2>(body2),
new type_to_key_function_body_leaf<T3, K, Body3>(body3),
new type_to_key_function_body_leaf<T4, K, Body4>(body4),
new type_to_key_function_body_leaf<T5, K, Body5>(body5)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 6, "wrong number of body initializers");
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
#endif
#if __TBB_VARIADIC_MAX >= 7
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<7,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<7,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
typedef typename std::tuple_element<2, OutputTuple>::type T2;
typedef typename std::tuple_element<3, OutputTuple>::type T3;
typedef typename std::tuple_element<4, OutputTuple>::type T4;
typedef typename std::tuple_element<5, OutputTuple>::type T5;
typedef typename std::tuple_element<6, OutputTuple>::type T6;
public:
typedef typename wrap_key_tuple_elements<7,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
private:
typedef join_node_base<key_matching<K,KHash> , input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef type_to_key_function_body<T2, K> *f2_p;
typedef type_to_key_function_body<T3, K> *f3_p;
typedef type_to_key_function_body<T4, K> *f4_p;
typedef type_to_key_function_body<T5, K> *f5_p;
typedef type_to_key_function_body<T6, K> *f6_p;
typedef std::tuple< f0_p, f1_p, f2_p, f3_p, f4_p, f5_p, f6_p > func_initializer_type;
public:
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>()),
new type_to_key_function_body_leaf<T2, K, key_from_message_body<K,T2> >(key_from_message_body<K,T2>()),
new type_to_key_function_body_leaf<T3, K, key_from_message_body<K,T3> >(key_from_message_body<K,T3>()),
new type_to_key_function_body_leaf<T4, K, key_from_message_body<K,T4> >(key_from_message_body<K,T4>()),
new type_to_key_function_body_leaf<T5, K, key_from_message_body<K,T5> >(key_from_message_body<K,T5>()),
new type_to_key_function_body_leaf<T6, K, key_from_message_body<K,T6> >(key_from_message_body<K,T6>())
) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1, typename Body2, typename Body3, typename Body4,
typename Body5, typename Body6>
unfolded_join_node(graph &g, Body0 body0, Body1 body1, Body2 body2, Body3 body3, Body4 body4,
Body5 body5, Body6 body6) : base_type(g, func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1),
new type_to_key_function_body_leaf<T2, K, Body2>(body2),
new type_to_key_function_body_leaf<T3, K, Body3>(body3),
new type_to_key_function_body_leaf<T4, K, Body4>(body4),
new type_to_key_function_body_leaf<T5, K, Body5>(body5),
new type_to_key_function_body_leaf<T6, K, Body6>(body6)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 7, "wrong number of body initializers");
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
#endif
#if __TBB_VARIADIC_MAX >= 8
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<8,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<8,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
typedef typename std::tuple_element<2, OutputTuple>::type T2;
typedef typename std::tuple_element<3, OutputTuple>::type T3;
typedef typename std::tuple_element<4, OutputTuple>::type T4;
typedef typename std::tuple_element<5, OutputTuple>::type T5;
typedef typename std::tuple_element<6, OutputTuple>::type T6;
typedef typename std::tuple_element<7, OutputTuple>::type T7;
public:
typedef typename wrap_key_tuple_elements<8,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
private:
typedef join_node_base<key_matching<K,KHash> , input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef type_to_key_function_body<T2, K> *f2_p;
typedef type_to_key_function_body<T3, K> *f3_p;
typedef type_to_key_function_body<T4, K> *f4_p;
typedef type_to_key_function_body<T5, K> *f5_p;
typedef type_to_key_function_body<T6, K> *f6_p;
typedef type_to_key_function_body<T7, K> *f7_p;
typedef std::tuple< f0_p, f1_p, f2_p, f3_p, f4_p, f5_p, f6_p, f7_p > func_initializer_type;
public:
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>()),
new type_to_key_function_body_leaf<T2, K, key_from_message_body<K,T2> >(key_from_message_body<K,T2>()),
new type_to_key_function_body_leaf<T3, K, key_from_message_body<K,T3> >(key_from_message_body<K,T3>()),
new type_to_key_function_body_leaf<T4, K, key_from_message_body<K,T4> >(key_from_message_body<K,T4>()),
new type_to_key_function_body_leaf<T5, K, key_from_message_body<K,T5> >(key_from_message_body<K,T5>()),
new type_to_key_function_body_leaf<T6, K, key_from_message_body<K,T6> >(key_from_message_body<K,T6>()),
new type_to_key_function_body_leaf<T7, K, key_from_message_body<K,T7> >(key_from_message_body<K,T7>())
) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1, typename Body2, typename Body3, typename Body4,
typename Body5, typename Body6, typename Body7>
unfolded_join_node(graph &g, Body0 body0, Body1 body1, Body2 body2, Body3 body3, Body4 body4,
Body5 body5, Body6 body6, Body7 body7) : base_type(g, func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1),
new type_to_key_function_body_leaf<T2, K, Body2>(body2),
new type_to_key_function_body_leaf<T3, K, Body3>(body3),
new type_to_key_function_body_leaf<T4, K, Body4>(body4),
new type_to_key_function_body_leaf<T5, K, Body5>(body5),
new type_to_key_function_body_leaf<T6, K, Body6>(body6),
new type_to_key_function_body_leaf<T7, K, Body7>(body7)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 8, "wrong number of body initializers");
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
#endif
#if __TBB_VARIADIC_MAX >= 9
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<9,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<9,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
typedef typename std::tuple_element<2, OutputTuple>::type T2;
typedef typename std::tuple_element<3, OutputTuple>::type T3;
typedef typename std::tuple_element<4, OutputTuple>::type T4;
typedef typename std::tuple_element<5, OutputTuple>::type T5;
typedef typename std::tuple_element<6, OutputTuple>::type T6;
typedef typename std::tuple_element<7, OutputTuple>::type T7;
typedef typename std::tuple_element<8, OutputTuple>::type T8;
public:
typedef typename wrap_key_tuple_elements<9,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
private:
typedef join_node_base<key_matching<K,KHash> , input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef type_to_key_function_body<T2, K> *f2_p;
typedef type_to_key_function_body<T3, K> *f3_p;
typedef type_to_key_function_body<T4, K> *f4_p;
typedef type_to_key_function_body<T5, K> *f5_p;
typedef type_to_key_function_body<T6, K> *f6_p;
typedef type_to_key_function_body<T7, K> *f7_p;
typedef type_to_key_function_body<T8, K> *f8_p;
typedef std::tuple< f0_p, f1_p, f2_p, f3_p, f4_p, f5_p, f6_p, f7_p, f8_p > func_initializer_type;
public:
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>()),
new type_to_key_function_body_leaf<T2, K, key_from_message_body<K,T2> >(key_from_message_body<K,T2>()),
new type_to_key_function_body_leaf<T3, K, key_from_message_body<K,T3> >(key_from_message_body<K,T3>()),
new type_to_key_function_body_leaf<T4, K, key_from_message_body<K,T4> >(key_from_message_body<K,T4>()),
new type_to_key_function_body_leaf<T5, K, key_from_message_body<K,T5> >(key_from_message_body<K,T5>()),
new type_to_key_function_body_leaf<T6, K, key_from_message_body<K,T6> >(key_from_message_body<K,T6>()),
new type_to_key_function_body_leaf<T7, K, key_from_message_body<K,T7> >(key_from_message_body<K,T7>()),
new type_to_key_function_body_leaf<T8, K, key_from_message_body<K,T8> >(key_from_message_body<K,T8>())
) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1, typename Body2, typename Body3, typename Body4,
typename Body5, typename Body6, typename Body7, typename Body8>
unfolded_join_node(graph &g, Body0 body0, Body1 body1, Body2 body2, Body3 body3, Body4 body4,
Body5 body5, Body6 body6, Body7 body7, Body8 body8) : base_type(g, func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1),
new type_to_key_function_body_leaf<T2, K, Body2>(body2),
new type_to_key_function_body_leaf<T3, K, Body3>(body3),
new type_to_key_function_body_leaf<T4, K, Body4>(body4),
new type_to_key_function_body_leaf<T5, K, Body5>(body5),
new type_to_key_function_body_leaf<T6, K, Body6>(body6),
new type_to_key_function_body_leaf<T7, K, Body7>(body7),
new type_to_key_function_body_leaf<T8, K, Body8>(body8)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 9, "wrong number of body initializers");
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
#endif
#if __TBB_VARIADIC_MAX >= 10
template<typename OutputTuple, typename K, typename KHash>
class unfolded_join_node<10,key_matching_port,OutputTuple,key_matching<K,KHash> > : public
join_base<10,key_matching_port,OutputTuple,key_matching<K,KHash> >::type {
typedef typename std::tuple_element<0, OutputTuple>::type T0;
typedef typename std::tuple_element<1, OutputTuple>::type T1;
typedef typename std::tuple_element<2, OutputTuple>::type T2;
typedef typename std::tuple_element<3, OutputTuple>::type T3;
typedef typename std::tuple_element<4, OutputTuple>::type T4;
typedef typename std::tuple_element<5, OutputTuple>::type T5;
typedef typename std::tuple_element<6, OutputTuple>::type T6;
typedef typename std::tuple_element<7, OutputTuple>::type T7;
typedef typename std::tuple_element<8, OutputTuple>::type T8;
typedef typename std::tuple_element<9, OutputTuple>::type T9;
public:
typedef typename wrap_key_tuple_elements<10,key_matching_port,key_matching<K,KHash>,OutputTuple>::type input_ports_type;
typedef OutputTuple output_type;
private:
typedef join_node_base<key_matching<K,KHash> , input_ports_type, output_type > base_type;
typedef type_to_key_function_body<T0, K> *f0_p;
typedef type_to_key_function_body<T1, K> *f1_p;
typedef type_to_key_function_body<T2, K> *f2_p;
typedef type_to_key_function_body<T3, K> *f3_p;
typedef type_to_key_function_body<T4, K> *f4_p;
typedef type_to_key_function_body<T5, K> *f5_p;
typedef type_to_key_function_body<T6, K> *f6_p;
typedef type_to_key_function_body<T7, K> *f7_p;
typedef type_to_key_function_body<T8, K> *f8_p;
typedef type_to_key_function_body<T9, K> *f9_p;
typedef std::tuple< f0_p, f1_p, f2_p, f3_p, f4_p, f5_p, f6_p, f7_p, f8_p, f9_p > func_initializer_type;
public:
#if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING
unfolded_join_node(graph &g) : base_type(g,
func_initializer_type(
new type_to_key_function_body_leaf<T0, K, key_from_message_body<K,T0> >(key_from_message_body<K,T0>()),
new type_to_key_function_body_leaf<T1, K, key_from_message_body<K,T1> >(key_from_message_body<K,T1>()),
new type_to_key_function_body_leaf<T2, K, key_from_message_body<K,T2> >(key_from_message_body<K,T2>()),
new type_to_key_function_body_leaf<T3, K, key_from_message_body<K,T3> >(key_from_message_body<K,T3>()),
new type_to_key_function_body_leaf<T4, K, key_from_message_body<K,T4> >(key_from_message_body<K,T4>()),
new type_to_key_function_body_leaf<T5, K, key_from_message_body<K,T5> >(key_from_message_body<K,T5>()),
new type_to_key_function_body_leaf<T6, K, key_from_message_body<K,T6> >(key_from_message_body<K,T6>()),
new type_to_key_function_body_leaf<T7, K, key_from_message_body<K,T7> >(key_from_message_body<K,T7>()),
new type_to_key_function_body_leaf<T8, K, key_from_message_body<K,T8> >(key_from_message_body<K,T8>()),
new type_to_key_function_body_leaf<T9, K, key_from_message_body<K,T9> >(key_from_message_body<K,T9>())
) ) {
}
#endif /* __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING */
template<typename Body0, typename Body1, typename Body2, typename Body3, typename Body4,
typename Body5, typename Body6, typename Body7, typename Body8, typename Body9>
unfolded_join_node(graph &g, Body0 body0, Body1 body1, Body2 body2, Body3 body3, Body4 body4,
Body5 body5, Body6 body6, Body7 body7, Body8 body8, Body9 body9) : base_type(g, func_initializer_type(
new type_to_key_function_body_leaf<T0, K, Body0>(body0),
new type_to_key_function_body_leaf<T1, K, Body1>(body1),
new type_to_key_function_body_leaf<T2, K, Body2>(body2),
new type_to_key_function_body_leaf<T3, K, Body3>(body3),
new type_to_key_function_body_leaf<T4, K, Body4>(body4),
new type_to_key_function_body_leaf<T5, K, Body5>(body5),
new type_to_key_function_body_leaf<T6, K, Body6>(body6),
new type_to_key_function_body_leaf<T7, K, Body7>(body7),
new type_to_key_function_body_leaf<T8, K, Body8>(body8),
new type_to_key_function_body_leaf<T9, K, Body9>(body9)
) ) {
static_assert(std::tuple_size<OutputTuple>::value == 10, "wrong number of body initializers");
}
unfolded_join_node(const unfolded_join_node &other) : base_type(other) {}
};
#endif
//! templated function to refer to input ports of the join node
template<size_t N, typename JNT>
typename std::tuple_element<N, typename JNT::input_ports_type>::type &input_port(JNT &jn) {
+6 -7
View File
@@ -2111,10 +2111,10 @@ protected:
template<typename OutputTuple, typename JP=queueing> class join_node;
template<typename OutputTuple>
class join_node<OutputTuple,reserving>: public unfolded_join_node<std::tuple_size<OutputTuple>::value, reserving_port, OutputTuple, reserving> {
class join_node<OutputTuple,reserving>: public unfolded_join_node<reserving_port, OutputTuple, reserving> {
private:
static const int N = std::tuple_size<OutputTuple>::value;
typedef unfolded_join_node<N, reserving_port, OutputTuple, reserving> unfolded_type;
typedef unfolded_join_node<reserving_port, OutputTuple, reserving> unfolded_type;
public:
typedef OutputTuple output_type;
typedef typename unfolded_type::input_ports_type input_ports_type;
@@ -2138,10 +2138,10 @@ public:
};
template<typename OutputTuple>
class join_node<OutputTuple,queueing>: public unfolded_join_node<std::tuple_size<OutputTuple>::value, queueing_port, OutputTuple, queueing> {
class join_node<OutputTuple,queueing>: public unfolded_join_node<queueing_port, OutputTuple, queueing> {
private:
static const int N = std::tuple_size<OutputTuple>::value;
typedef unfolded_join_node<N, queueing_port, OutputTuple, queueing> unfolded_type;
typedef unfolded_join_node<queueing_port, OutputTuple, queueing> unfolded_type;
public:
typedef OutputTuple output_type;
typedef typename unfolded_type::input_ports_type input_ports_type;
@@ -2183,11 +2183,10 @@ concept join_node_functions = requires {
// template for key_matching join_node
// tag_matching join_node is a specialization of key_matching, and is source-compatible.
template<typename OutputTuple, typename K, typename KHash>
class join_node<OutputTuple, key_matching<K, KHash> > : public unfolded_join_node<std::tuple_size<OutputTuple>::value,
key_matching_port, OutputTuple, key_matching<K,KHash> > {
class join_node<OutputTuple, key_matching<K, KHash> > : public unfolded_join_node<key_matching_port, OutputTuple, key_matching<K,KHash> > {
private:
static const int N = std::tuple_size<OutputTuple>::value;
typedef unfolded_join_node<N, key_matching_port, OutputTuple, key_matching<K,KHash> > unfolded_type;
typedef unfolded_join_node<key_matching_port, OutputTuple, key_matching<K,KHash> > unfolded_type;
public:
typedef OutputTuple output_type;
typedef typename unfolded_type::input_ports_type input_ports_type;
+1
View File
@@ -14,6 +14,7 @@
limitations under the License.
*/
#define MAX_TUPLE_TEST_SIZE 10
#include "common/config.h"
#include "test_join_node.h"