17 #ifndef __TBB_flow_graph_H 18 #define __TBB_flow_graph_H 20 #define __TBB_flow_graph_H_include_area 37 #if TBB_USE_THREADING_TOOLS && TBB_PREVIEW_FLOW_GRAPH_TRACE && ( __linux__ || __APPLE__ ) 40 #pragma warning (push) 41 #pragma warning( disable: 2196 ) 43 #define __TBB_NOINLINE_SYM __attribute__((noinline)) 45 #define __TBB_NOINLINE_SYM 48 #if __TBB_PREVIEW_ASYNC_MSG 53 #if __TBB_PREVIEW_STREAMING_NODE 56 #include <unordered_map> 57 #include <type_traits> 58 #endif // __TBB_PREVIEW_STREAMING_NODE 60 #if TBB_DEPRECATED_FLOW_ENQUEUE 61 #define FLOW_SPAWN(a) tbb::task::enqueue((a)) 63 #define FLOW_SPAWN(a) tbb::task::spawn((a)) 67 #if __TBB_CPP11_TUPLE_PRESENT 72 using std::tuple_size;
73 using std::tuple_element;
78 #include "compat/tuple" 100 namespace interface11 {
123 template<
typename T,
typename M>
class reservable_predecessor_cache;
125 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 130 template<
typename Order,
typename... Args>
struct node_set;
133 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 137 class edge_container {
140 typedef std::list<C *, tbb::tbb_allocator<C *> > edge_list_type;
142 void add_edge(C &
s) {
143 built_edges.push_back(&s);
146 void delete_edge(C &s) {
147 for (
typename edge_list_type::iterator i = built_edges.begin(); i != built_edges.end(); ++i) {
155 void copy_edges(edge_list_type &v) {
159 size_t edge_count() {
160 return (
size_t)(built_edges.size());
169 template<
typename S >
void sender_extract(
S &s);
170 template<
typename R >
void receiver_extract(R &r);
173 edge_list_type built_edges;
188 namespace interface11 {
193 if (right == NULL)
return left;
195 if (left == NULL)
return right;
206 #if __TBB_PREVIEW_ASYNC_MSG 214 template<
typename T,
typename =
void >
217 typedef T filtered_type;
219 static const bool is_async_type =
false;
222 return static_cast<const void*
>(&t);
226 return static_cast<void*
>(&t);
229 static const T& from_void_ptr(
const void*
p) {
230 return *
static_cast<const T*
>(
p);
234 return *
static_cast<T*
>(
p);
237 static task* try_put_task_wrapper_impl(
receiver<T>*
const this_recv,
const void *
p,
bool is_async) {
255 template<
typename T >
257 typedef T async_type;
260 static const bool is_async_type =
true;
312 virtual bool register_successor( successor_type &r ) = 0;
315 virtual bool remove_successor( successor_type &r ) = 0;
323 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 324 typedef internal::edge_container<successor_type> built_successors_type;
326 typedef built_successors_type::edge_list_type successor_list_type;
327 virtual built_successors_type &built_successors() = 0;
328 virtual void internal_add_built_successor( successor_type & ) = 0;
329 virtual void internal_delete_built_successor( successor_type & ) = 0;
330 virtual void copy_successors( successor_list_type &) = 0;
331 virtual size_t successor_count() = 0;
335 template<
typename X >
341 template<
typename X >
346 virtual bool try_get_wrapper(
void* p,
bool is_async ) = 0;
347 virtual bool try_reserve_wrapper(
void* p,
bool is_async ) = 0;
357 #if __TBB_PREVIEW_OPENCL_NODE 358 template<
typename,
typename >
friend class proxy_dependency_receiver;
371 if (!res)
return false;
381 virtual bool register_predecessor( predecessor_type & ) {
return false; }
386 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 387 typedef internal::edge_container<predecessor_type> built_predecessors_type;
388 typedef built_predecessors_type::edge_list_type predecessor_list_type;
389 virtual built_predecessors_type &built_predecessors() = 0;
390 virtual void internal_add_built_predecessor( predecessor_type & ) = 0;
391 virtual void internal_delete_built_predecessor( predecessor_type & ) = 0;
392 virtual void copy_predecessors( predecessor_list_type & ) = 0;
393 virtual size_t predecessor_count() = 0;
401 virtual task* try_put_task_wrapper(
const void* p,
bool is_async ) = 0;
403 virtual graph& graph_reference()
const = 0;
410 virtual bool is_continue_receiver() {
return false; }
416 template<
typename T >
437 __TBB_ASSERT(
false,
"async_msg interface does not support 'pull' protocol in try_get()");
447 __TBB_ASSERT(
false,
"async_msg interface does not support 'pull' protocol in try_reserve()");
453 template<
typename T >
465 return internal::untyped_receiver::try_put(t);
469 return internal::untyped_receiver::try_put(t);
478 virtual task *try_put_task(
const T& t) = 0;
482 #else // __TBB_PREVIEW_ASYNC_MSG 485 template<
typename T >
505 virtual bool try_get( T & ) {
return false; }
508 virtual bool try_reserve( T & ) {
return false; }
511 virtual bool try_release( ) {
return false; }
514 virtual bool try_consume( ) {
return false; }
516 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 517 __TBB_DEPRECATED typedef typename internal::edge_container<successor_type> built_successors_type;
519 __TBB_DEPRECATED typedef typename built_successors_type::edge_list_type successor_list_type;
529 template<
typename T >
542 bool try_put(
const T& t ) {
543 task *res = try_put_task(t);
544 if (!res)
return false;
555 virtual graph& graph_reference()
const = 0;
565 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 566 __TBB_DEPRECATED typedef typename internal::edge_container<predecessor_type> built_predecessors_type;
567 __TBB_DEPRECATED typedef typename built_predecessors_type::edge_list_type predecessor_list_type;
570 __TBB_DEPRECATED virtual void internal_delete_built_predecessor( predecessor_type & ) = 0;
580 virtual bool is_continue_receiver() {
return false; }
582 #if __TBB_PREVIEW_OPENCL_NODE 583 template<
typename,
typename >
friend class proxy_dependency_receiver;
587 #endif // __TBB_PREVIEW_ASYNC_MSG 603 my_predecessor_count = my_initial_predecessor_count = number_of_predecessors;
604 my_current_count = 0;
611 my_current_count = 0;
618 ++my_predecessor_count;
628 --my_predecessor_count;
632 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 633 __TBB_DEPRECATED typedef internal::edge_container<predecessor_type> built_predecessors_type;
635 built_predecessors_type &built_predecessors()
__TBB_override {
return my_built_predecessors; }
639 my_built_predecessors.add_edge( s );
644 my_built_predecessors.delete_edge(s);
649 my_built_predecessors.copy_edges(v);
654 return my_built_predecessors.edge_count();
667 if ( ++my_current_count < my_predecessor_count )
670 my_current_count = 0;
676 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 679 built_predecessors_type my_built_predecessors;
691 my_current_count = 0;
693 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 694 my_built_predecessors.clear();
696 my_predecessor_count = my_initial_predecessor_count;
703 virtual task * execute() = 0;
711 #if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING 712 template <
typename K,
typename T>
729 namespace interface11 {
734 #if __TBB_PREVIEW_ASYNC_MSG 739 template <
typename C,
typename N>
742 if (begin) current_node = my_graph->my_nodes;
746 template <
typename C,
typename N>
749 return *operator->();
752 template <
typename C,
typename N>
757 template <
typename C,
typename N>
759 if (current_node) current_node = current_node->next;
764 namespace interface10 {
766 inline graph::graph() : my_nodes(NULL), my_nodes_last(NULL), my_task_arena(NULL) {
870 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 871 inline void graph::set_name(
const char *
name) {
878 namespace interface11 {
890 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 891 using internal::node_set;
895 template <
typename Output >
907 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 913 template<
typename Body >
915 :
graph_node(g), my_active(is_active), init_my_active(is_active),
918 my_reserved(false), my_has_cached_item(false)
920 my_successors.set_owner(
this);
925 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 926 template <
typename Body,
typename... Successors>
927 source_node(
const node_set<internal::order::preceding, Successors...>& successors, Body body,
bool is_active =
true )
929 make_edges(*
this, successors);
936 my_active(src.init_my_active),
937 init_my_active(src.init_my_active), my_body( src.my_init_body->clone() ), my_init_body(src.my_init_body->clone() ),
938 my_reserved(false), my_has_cached_item(false)
940 my_successors.set_owner(
this);
948 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 957 my_successors.register_successor(r);
966 my_successors.remove_successor(r);
970 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 972 built_successors_type &built_successors()
__TBB_override {
return my_successors.built_successors(); }
974 void internal_add_built_successor( successor_type &r)
__TBB_override {
976 my_successors.internal_add_built_successor(r);
979 void internal_delete_built_successor( successor_type &r)
__TBB_override {
981 my_successors.internal_delete_built_successor(r);
986 return my_successors.successor_count();
991 my_successors.copy_successors(v);
1001 if ( my_has_cached_item ) {
1003 my_has_cached_item =
false;
1015 if ( my_reserved ) {
1019 if ( my_has_cached_item ) {
1032 __TBB_ASSERT( my_reserved && my_has_cached_item,
"releasing non-existent reservation" );
1033 my_reserved =
false;
1034 if(!my_successors.empty())
1042 __TBB_ASSERT( my_reserved && my_has_cached_item,
"consuming non-existent reservation" );
1043 my_reserved =
false;
1044 my_has_cached_item =
false;
1045 if ( !my_successors.empty() ) {
1055 if (!my_successors.empty())
1059 template<
typename Body>
1065 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1067 my_successors.built_successors().sender_extract(*
this);
1068 my_active = init_my_active;
1069 my_reserved =
false;
1070 if(my_has_cached_item) my_has_cached_item =
false;
1078 my_active = init_my_active;
1080 if(my_has_cached_item) {
1081 my_has_cached_item =
false;
1107 if ( my_reserved ) {
1110 if ( !my_has_cached_item ) {
1112 bool r = (*my_body)(my_cached_item);
1115 my_has_cached_item =
true;
1118 if ( my_has_cached_item ) {
1132 return (
new ( task::allocate_additional_child_of( *(this->
my_graph.
root_task()) ) )
1147 if ( !try_reserve_apply_body(v) )
1160 template <
typename Input,
typename Output = continue_msg,
typename Policy = queueing,
typename Allocator=cache_aligned_allocator<Input> >
1170 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1171 typedef typename input_impl_type::predecessor_list_type predecessor_list_type;
1172 typedef typename fOutput_type::successor_list_type successor_list_type;
1174 using input_impl_type::my_predecessors;
1180 template<
typename Body >
1193 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES && __TBB_CPP11_PRESENT 1194 template <
typename Body>
1197 #endif // __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES && __TBB_CPP11_PRESENT 1199 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1200 template <
typename Body,
typename... Args>
1201 function_node(
const node_set<Args...>& nodes,
size_t concurrency, Body body,
1204 make_edges_in_order(nodes, *
this);
1207 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 1208 template <
typename Body,
typename... Args>
1211 #endif // __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 1212 #endif // __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1217 input_impl_type(src),
1223 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 1229 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1231 my_predecessors.built_predecessors().receiver_extract(*
this);
1232 successors().built_successors().sender_extract(*
this);
1240 using input_impl_type::try_put_task;
1245 input_impl_type::reset_function_input(f);
1247 if(f & rf_clear_edges) {
1248 successors().clear();
1249 my_predecessors.clear();
1251 __TBB_ASSERT(!(f & rf_clear_edges) || successors().
empty(),
"function_node successors not empty");
1252 __TBB_ASSERT(this->my_predecessors.empty(),
"function_node predecessors not empty");
1259 template <
typename Input,
typename Output,
typename Policy = queueing,
typename Allocator=cache_aligned_allocator<Input> >
1265 typename internal::wrap_tuple_elements<
1266 tbb::flow::tuple_size<Output>::value,
1267 internal::multifunction_output,
1283 using input_impl_type::my_predecessors;
1285 template<
typename Body>
1287 graph &g,
size_t concurrency,
1294 tbb::internal::fgt_multioutput_node_with_body<N>(
1295 CODEPTR(), tbb::internal::FLOW_MULTIFUNCTION_NODE,
1297 this->output_ports(), this->my_body
1301 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES && __TBB_CPP11_PRESENT 1302 template <
typename Body>
1304 : multifunction_node(g, concurrency, body,
Policy(), priority) {}
1305 #endif // TBB_PREVIEW_FLOW_GRAPH_PRIORITIES && __TBB_CPP11_PRESENT 1307 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1308 template <
typename Body,
typename... Args>
1312 make_edges_in_order(nodes, *
this);
1315 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 1316 template <
typename Body,
typename... Args>
1318 : multifunction_node(nodes, concurrency, body,
Policy(), priority) {}
1319 #endif // __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 1320 #endif // __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1324 tbb::internal::fgt_multioutput_node_with_body<N>(
CODEPTR(), tbb::internal::FLOW_MULTIFUNCTION_NODE,
1326 this->output_ports(), this->my_body );
1329 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 1335 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1337 my_predecessors.built_predecessors().receiver_extract(*
this);
1338 base_type::extract();
1348 template<
typename TupleType,
typename Allocator=cache_aligned_allocator<TupleType> >
1355 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1357 typedef typename base_type::predecessor_list_type predecessor_list_type;
1359 typedef typename predecessor_cache_type::built_predecessors_type built_predecessors_type;
1370 my_output_ports(
internal::init_output_ports<output_ports_type>::
call(g, my_output_ports))
1372 tbb::internal::fgt_multioutput_node<N>(
CODEPTR(), tbb::internal::FLOW_SPLIT_NODE, &this->
my_graph,
1376 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1377 template <
typename... Args>
1379 make_edges_in_order(nodes, *
this);
1385 my_output_ports(
internal::init_output_ports<output_ports_type>::
call(other.
my_graph, my_output_ports))
1387 tbb::internal::fgt_multioutput_node<N>(
CODEPTR(), tbb::internal::FLOW_SPLIT_NODE, &this->
my_graph,
1391 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 1406 if (f & rf_clear_edges)
1415 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1420 void internal_add_built_predecessor(predecessor_type&)
__TBB_override {}
1423 void internal_delete_built_predecessor(predecessor_type&)
__TBB_override {}
1429 built_predecessors_type &built_predecessors()
__TBB_override {
return my_predessors; }
1432 built_predecessors_type my_predessors;
1440 template <
typename Output,
typename Policy =
internal::Policy<
void> >
1452 template <
typename Body >
1468 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES && __TBB_CPP11_PRESENT 1469 template <
typename Body>
1474 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1475 template <
typename Body,
typename... Args>
1479 make_edges_in_order(nodes, *
this);
1481 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 1482 template <
typename Body,
typename... Args>
1484 : continue_node(nodes, body,
Policy(), priority) {}
1485 #endif // __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 1486 #endif // __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1489 template <
typename Body >
1491 graph &g,
int number_of_predecessors,
1505 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES && __TBB_CPP11_PRESENT 1506 template <
typename Body>
1508 : continue_node(g, number_of_predecessors, body,
Policy(), priority) {}
1511 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1512 template <
typename Body,
typename... Args>
1513 continue_node(
const node_set<Args...>& nodes,
int number_of_predecessors,
1516 make_edges_in_order(nodes, *
this);
1519 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 1520 template <
typename Body,
typename... Args>
1521 continue_node(
const node_set<Args...>& nodes,
int number_of_predecessors,
1523 : continue_node(nodes, number_of_predecessors, body,
Policy(), priority) {}
1536 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 1542 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1544 input_impl_type::my_built_predecessors.receiver_extract(*
this);
1545 successors().built_successors().sender_extract(*
this);
1553 using input_impl_type::try_put_task;
1557 input_impl_type::reset_receiver(f);
1558 if(f & rf_clear_edges)successors().clear();
1559 __TBB_ASSERT(!(f & rf_clear_edges) || successors().
empty(),
"continue_node not reset");
1564 template <
typename T>
1571 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1577 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1578 internal::edge_container<predecessor_type> my_built_predecessors;
1589 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 1590 template <
typename... Args>
1591 broadcast_node(
const node_set<Args...>& nodes) : broadcast_node(nodes.graph_reference()) {
1592 make_edges_in_order(nodes, *
this);
1605 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 1623 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1626 built_successors_type &built_successors()
__TBB_override {
return my_successors.built_successors(); }
1629 my_successors.internal_add_built_successor(r);
1632 void internal_delete_built_successor(successor_type &r)
__TBB_override {
1633 my_successors.internal_delete_built_successor(r);
1637 return my_successors.successor_count();
1641 my_successors.copy_successors(v);
1646 built_predecessors_type &built_predecessors()
__TBB_override {
return my_built_predecessors; }
1648 void internal_add_built_predecessor( predecessor_type &p)
__TBB_override {
1650 my_built_predecessors.add_edge(p);
1655 my_built_predecessors.delete_edge(p);
1660 return my_built_predecessors.edge_count();
1665 my_built_predecessors.copy_edges(v);
1669 my_built_predecessors.receiver_extract(*
this);
1670 my_successors.built_successors().sender_extract(*
this);
1692 if (f&rf_clear_edges) {
1693 my_successors.
clear();
1694 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1695 my_built_predecessors.clear();
1698 __TBB_ASSERT(!(f & rf_clear_edges) || my_successors.
empty(),
"Error resetting broadcast_node");
1703 template <
typename T,
typename A=cache_aligned_allocator<T> >
1711 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1719 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1720 internal::edge_container<predecessor_type> my_built_predecessors;
1725 enum op_type {reg_succ, rem_succ, req_item, res_item, rel_res, con_res, put_item, try_fwd_task
1726 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1727 , add_blt_succ, del_blt_succ,
1728 add_blt_pred, del_blt_pred,
1729 blt_succ_cnt, blt_pred_cnt,
1730 blt_succ_cpy, blt_pred_cpy
1738 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1743 predecessor_type *
p;
1745 successor_list_type *svec;
1746 predecessor_list_type *pvec;
1753 buffer_operation(
const T& e,
op_type t) : type(char(t))
1755 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
1756 , ltask(NULL), elem(const_cast<T*>(&e))
1758 , elem(const_cast<T*>(&e)) , ltask(NULL)
1765 typedef internal::aggregating_functor<class_type, buffer_operation>
handler_type;
1770 handle_operations_impl(op_list,
this);
1773 template<
typename derived_type>
1775 __TBB_ASSERT(static_cast<class_type*>(derived) ==
this,
"'this' is not a base class for derived");
1778 bool try_forwarding =
false;
1781 op_list = op_list->next;
1782 switch (tmp->
type) {
1783 case reg_succ: internal_reg_succ(tmp); try_forwarding =
true;
break;
1784 case rem_succ: internal_rem_succ(tmp);
break;
1785 case req_item: internal_pop(tmp);
break;
1786 case res_item: internal_reserve(tmp);
break;
1787 case rel_res: internal_release(tmp); try_forwarding =
true;
break;
1788 case con_res: internal_consume(tmp); try_forwarding =
true;
break;
1789 case put_item: try_forwarding = internal_push(tmp);
break;
1790 case try_fwd_task: internal_forward_task(tmp);
break;
1791 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1793 case add_blt_succ: internal_add_built_succ(tmp);
break;
1794 case del_blt_succ: internal_del_built_succ(tmp);
break;
1795 case add_blt_pred: internal_add_built_pred(tmp);
break;
1796 case del_blt_pred: internal_del_built_pred(tmp);
break;
1797 case blt_succ_cnt: internal_succ_cnt(tmp);
break;
1798 case blt_pred_cnt: internal_pred_cnt(tmp);
break;
1799 case blt_succ_cpy: internal_copy_succs(tmp);
break;
1800 case blt_pred_cpy: internal_copy_preds(tmp);
break;
1807 if (try_forwarding && !forwarder_busy) {
1809 forwarder_busy =
true;
1827 inline bool enqueue_forwarding_task(buffer_operation &op_data) {
1828 task *ft = grab_forwarding_task(op_data);
1839 task *last_task = NULL;
1842 op_data.
ltask = NULL;
1843 my_aggregator.
execute(&op_data);
1865 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1868 built_successors_type &built_successors()
__TBB_override {
return my_successors.built_successors(); }
1870 virtual void internal_add_built_succ(buffer_operation *op) {
1871 my_successors.internal_add_built_successor(*(op->r));
1875 virtual void internal_del_built_succ(buffer_operation *op) {
1876 my_successors.internal_delete_built_successor(*(op->r));
1882 built_predecessors_type &built_predecessors()
__TBB_override {
return my_built_predecessors; }
1884 virtual void internal_add_built_pred(buffer_operation *op) {
1885 my_built_predecessors.add_edge(*(op->p));
1889 virtual void internal_del_built_pred(buffer_operation *op) {
1890 my_built_predecessors.delete_edge(*(op->p));
1894 virtual void internal_succ_cnt(buffer_operation *op) {
1895 op->cnt_val = my_successors.successor_count();
1899 virtual void internal_pred_cnt(buffer_operation *op) {
1900 op->cnt_val = my_built_predecessors.edge_count();
1904 virtual void internal_copy_succs(buffer_operation *op) {
1905 my_successors.copy_successors(*(op->svec));
1909 virtual void internal_copy_preds(buffer_operation *op) {
1910 my_built_predecessors.copy_edges(*(op->pvec));
1920 return this->my_item_valid(this->my_tail - 1);
1929 this->destroy_back();
1935 virtual void internal_forward_task(buffer_operation *op) {
1936 internal_forward_task_impl(op,
this);
1939 template<
typename derived_type>
1941 __TBB_ASSERT(static_cast<class_type*>(derived) ==
this,
"'this' is not a base class for derived");
1943 if (this->my_reserved || !derived->is_item_valid()) {
1945 this->forwarder_busy =
false;
1950 size_type counter = my_successors.
size();
1951 for (; counter > 0 && derived->is_item_valid(); --counter)
1952 derived->try_put_and_add_task(last_task);
1955 if (last_task && !counter) {
1960 forwarder_busy =
false;
1965 this->push_back(*(op->
elem));
1971 if(this->pop_back(*(op->
elem))) {
1980 if(this->reserve_front(*(op->
elem))) {
1989 this->consume_front();
1994 this->release_front();
2001 forwarder_busy(false) {
2003 my_aggregator.initialize_handler(handler_type(
this));
2008 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 2009 template <
typename... Args>
2010 buffer_node(
const node_set<Args...>& nodes) : buffer_node(nodes.graph_reference()) {
2011 make_edges_in_order(nodes, *
this);
2018 forwarder_busy =
false;
2020 my_aggregator.initialize_handler(handler_type(
this));
2025 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 2040 my_aggregator.execute(&op_data);
2041 (
void)enqueue_forwarding_task(op_data);
2045 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 2046 void internal_add_built_successor( successor_type &r)
__TBB_override {
2049 my_aggregator.execute(&op_data);
2052 void internal_delete_built_successor( successor_type &r)
__TBB_override {
2055 my_aggregator.execute(&op_data);
2058 void internal_add_built_predecessor( predecessor_type &p)
__TBB_override {
2061 my_aggregator.execute(&op_data);
2064 void internal_delete_built_predecessor( predecessor_type &p)
__TBB_override {
2067 my_aggregator.execute(&op_data);
2072 my_aggregator.execute(&op_data);
2073 return op_data.cnt_val;
2078 my_aggregator.execute(&op_data);
2079 return op_data.cnt_val;
2082 void copy_predecessors( predecessor_list_type &v )
__TBB_override {
2085 my_aggregator.execute(&op_data);
2091 my_aggregator.execute(&op_data);
2103 my_aggregator.execute(&op_data);
2107 (
void)enqueue_forwarding_task(op_data);
2117 my_aggregator.execute(&op_data);
2118 (
void)enqueue_forwarding_task(op_data);
2128 my_aggregator.execute(&op_data);
2129 (
void)enqueue_forwarding_task(op_data);
2137 my_aggregator.execute(&op_data);
2138 (
void)enqueue_forwarding_task(op_data);
2146 my_aggregator.execute(&op_data);
2147 (
void)enqueue_forwarding_task(op_data);
2159 my_aggregator.execute(&op_data);
2160 task *ft = grab_forwarding_task(op_data);
2182 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 2185 my_built_predecessors.receiver_extract(*
this);
2186 my_successors.built_successors().sender_extract(*
this);
2194 if (f&rf_clear_edges) {
2195 my_successors.
clear();
2196 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 2197 my_built_predecessors.clear();
2200 forwarder_busy =
false;
2205 template <
typename T,
typename A=cache_aligned_allocator<T> >
2217 return this->my_item_valid(this->my_head);
2224 graph& graph_ref = this->graph_reference();
2226 this->destroy_front();
2232 this->internal_forward_task_impl(op,
this);
2236 if ( this->my_reserved || !this->my_item_valid(this->my_head)){
2240 this->pop_front(*(op->
elem));
2245 if (this->my_reserved || !this->my_item_valid(this->my_head)) {
2249 this->reserve_front(*(op->
elem));
2254 this->consume_front();
2271 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 2272 template <
typename... Args>
2273 queue_node(
const node_set<Args...>& nodes) : queue_node(nodes.graph_reference()) {
2274 make_edges_in_order(nodes, *
this);
2285 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 2293 base_type::reset_node(f);
2298 template<
typename T,
typename A=cache_aligned_allocator<T> >
2310 template<
typename Sequencer >
2312 my_sequencer(new
internal::function_body_leaf< T, size_t, Sequencer>(s) ) {
2318 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 2319 template <
typename Sequencer,
typename... Args>
2320 sequencer_node(
const node_set<Args...>& nodes,
const Sequencer& s)
2321 : sequencer_node(nodes.graph_reference(),
s) {
2322 make_edges_in_order(nodes, *
this);
2328 my_sequencer( src.my_sequencer->clone() ) {
2337 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 2349 size_type tag = (*my_sequencer)(*(op->
elem));
2350 #if !TBB_DEPRECATED_SEQUENCER_DUPLICATES 2351 if (tag < this->my_head) {
2358 size_t new_tail = (tag+1 > this->my_tail) ? tag+1 : this->my_tail;
2360 if (this->
size(new_tail) > this->capacity()) {
2361 this->grow_my_array(this->
size(new_tail));
2363 this->my_tail = new_tail;
2372 template<
typename T,
typename Compare = std::less<T>,
typename A=cache_aligned_allocator<T> >
2390 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 2391 template <
typename... Args>
2393 : priority_queue_node(nodes.graph_reference(), comp) {
2394 make_edges_in_order(nodes, *
this);
2405 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 2415 base_type::reset_node(f);
2424 this->internal_forward_task_impl(op,
this);
2428 this->handle_operations_impl(op_list,
this);
2432 prio_push(*(op->
elem));
2439 if ( this->my_reserved ==
true || this->my_tail == 0 ) {
2444 *(op->
elem) = prio();
2452 if (this->my_reserved ==
true || this->my_tail == 0) {
2456 this->my_reserved =
true;
2457 *(op->
elem) = prio();
2458 reserved_item = *(op->
elem);
2465 this->my_reserved =
false;
2466 reserved_item = input_type();
2471 prio_push(reserved_item);
2472 this->my_reserved =
false;
2473 reserved_item = input_type();
2480 if (mark < this->my_tail) heapify();
2481 __TBB_ASSERT(mark == this->my_tail,
"mark unequal after heapify");
2485 return this->my_tail > 0;
2492 graph& graph_ref = this->graph_reference();
2506 __TBB_ASSERT(mark <= this->my_tail,
"mark outside bounds before test");
2507 return mark < this->my_tail && compare(this->get_my_item(0), this->get_my_item(this->my_tail - 1));
2512 if ( this->my_tail >= this->my_array_size )
2513 this->grow_my_array( this->my_tail + 1 );
2514 (
void) this->place_item(this->my_tail, src);
2516 __TBB_ASSERT(mark < this->my_tail,
"mark outside bounds after push");
2523 if (prio_use_tail()) {
2526 this->destroy_item(this->my_tail-1);
2528 __TBB_ASSERT(mark <= this->my_tail,
"mark outside bounds after pop");
2531 this->destroy_item(0);
2532 if(this->my_tail > 1) {
2534 __TBB_ASSERT(this->my_item_valid(this->my_tail - 1), NULL);
2535 this->move_item(0,this->my_tail - 1);
2538 if(mark > this->my_tail) --mark;
2539 if (this->my_tail > 1)
2541 __TBB_ASSERT(mark <= this->my_tail,
"mark outside bounds after pop");
2545 return this->get_my_item(prio_use_tail() ? this->my_tail-1 : 0);
2550 if(this->my_tail == 0) {
2554 if (!mark) mark = 1;
2555 for (; mark<this->my_tail; ++mark) {
2556 size_type cur_pos = mark;
2557 input_type to_place;
2558 this->fetch_item(mark,to_place);
2560 size_type
parent = (cur_pos-1)>>1;
2561 if (!compare(this->get_my_item(parent), to_place))
2563 this->move_item(cur_pos, parent);
2566 (
void) this->place_item(cur_pos, to_place);
2572 size_type cur_pos=0, child=1;
2573 while (child < mark) {
2574 size_type target = child;
2576 compare(this->get_my_item(child),
2577 this->get_my_item(child+1)))
2580 if (compare(this->get_my_item(target),
2581 this->get_my_item(cur_pos)))
2584 this->swap_items(cur_pos, target);
2586 child = (cur_pos<<1)+1;
2593 namespace interface11 {
2599 template<
typename T,
typename DecrementType=continue_msg >
2606 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 2629 return ( my_count + my_tries < my_threshold && !my_predecessors.
empty() && !my_successors.
empty() );
2636 bool reserved =
false;
2639 if ( check_conditions() )
2656 if ( check_conditions() ) {
2674 if ( check_conditions() ) {
2694 if( delta > 0 &&
size_t(delta) > my_count )
2696 else if( delta < 0 &&
size_t(delta) > my_threshold - my_count )
2697 my_count = my_threshold;
2699 my_count -= size_t(delta);
2701 return forward_task();
2707 decrement.set_owner(
this);
2718 #if TBB_DEPRECATED_LIMITER_NODE_CONSTRUCTOR 2720 "Deprecated interface of the limiter node can be used only in conjunction " 2721 "with continue_msg as the type of DecrementType template parameter." );
2722 #endif // Check for incompatible interface 2727 :
graph_node(g), my_threshold(threshold), my_count(0),
2729 my_tries(0), decrement(),
2730 init_decrement_predecessors(num_decrement_predecessors),
2731 decrement(num_decrement_predecessors)) {
2735 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 2736 template <
typename... Args>
2737 limiter_node(
const node_set<Args...>& nodes,
size_t threshold)
2738 : limiter_node(nodes.graph_reference(), threshold) {
2739 make_edges_in_order(nodes, *
this);
2746 my_threshold(src.my_threshold), my_count(0),
2748 my_tries(0), decrement(),
2749 init_decrement_predecessors(src.init_decrement_predecessors),
2750 decrement(src.init_decrement_predecessors)) {
2754 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 2763 bool was_empty = my_successors.
empty();
2766 if ( was_empty && !my_predecessors.
empty() && my_count + my_tries < my_threshold ) {
2784 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 2785 built_successors_type &built_successors()
__TBB_override {
return my_successors.built_successors(); }
2786 built_predecessors_type &built_predecessors()
__TBB_override {
return my_predecessors.built_predecessors(); }
2788 void internal_add_built_successor(successor_type &src)
__TBB_override {
2789 my_successors.internal_add_built_successor(src);
2792 void internal_delete_built_successor(successor_type &src)
__TBB_override {
2793 my_successors.internal_delete_built_successor(src);
2796 size_t successor_count()
__TBB_override {
return my_successors.successor_count(); }
2799 my_successors.copy_successors(v);
2802 void internal_add_built_predecessor(predecessor_type &src)
__TBB_override {
2803 my_predecessors.internal_add_built_predecessor(src);
2806 void internal_delete_built_predecessor(predecessor_type &src)
__TBB_override {
2807 my_predecessors.internal_delete_built_predecessor(src);
2810 size_t predecessor_count()
__TBB_override {
return my_predecessors.predecessor_count(); }
2812 void copy_predecessors(predecessor_list_type &v)
__TBB_override {
2813 my_predecessors.copy_predecessors(v);
2818 my_successors.built_successors().sender_extract(*
this);
2819 my_predecessors.built_predecessors().receiver_extract(*
this);
2820 decrement.built_predecessors().receiver_extract(decrement);
2827 my_predecessors.
add( src );
2838 my_predecessors.
remove( src );
2851 if ( my_count + my_tries >= my_threshold )
2863 rtask =
new ( task::allocate_additional_child_of( *(this->
my_graph.
root_task()) ) )
2883 if(f & rf_clear_edges) {
2884 my_predecessors.
clear();
2885 my_successors.
clear();
2889 my_predecessors.
reset( );
2891 decrement.reset_receiver(f);
2903 template<
typename OutputTuple,
typename JP=queueing>
class join_node;
2905 template<
typename OutputTuple>
2914 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_RESERVING, &this->
my_graph,
2918 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 2919 template <
typename... Args>
2921 make_edges_in_order(nodes, *
this);
2926 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_RESERVING, &this->
my_graph,
2930 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 2938 template<
typename OutputTuple>
2947 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_QUEUEING, &this->
my_graph,
2951 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 2952 template <
typename... Args>
2954 make_edges_in_order(nodes, *
this);
2959 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_QUEUEING, &this->
my_graph,
2963 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 2973 template<
typename OutputTuple,
typename K,
typename KHash>
2975 key_matching_port, OutputTuple, key_matching<K,KHash> > {
2983 #if __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING 2986 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 2987 template <
typename... Args>
2989 : join_node(nodes.graph_reference()) {
2990 make_edges_in_order(nodes, *
this);
2996 template<
typename __TBB_B0,
typename __TBB_B1>
2998 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3001 template<
typename __TBB_B0,
typename __TBB_B1,
typename __TBB_B2>
3003 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3006 template<
typename __TBB_B0,
typename __TBB_B1,
typename __TBB_B2,
typename __TBB_B3>
3008 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3011 template<
typename __TBB_B0,
typename __TBB_B1,
typename __TBB_B2,
typename __TBB_B3,
typename __TBB_B4>
3013 unfolded_type(g, b0, b1, b2, b3, b4) {
3014 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3017 #if __TBB_VARIADIC_MAX >= 6 3018 template<
typename __TBB_B0,
typename __TBB_B1,
typename __TBB_B2,
typename __TBB_B3,
typename __TBB_B4,
3021 unfolded_type(g, b0, b1, b2, b3, b4, b5) {
3022 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3026 #if __TBB_VARIADIC_MAX >= 7 3027 template<
typename __TBB_B0,
typename __TBB_B1,
typename __TBB_B2,
typename __TBB_B3,
typename __TBB_B4,
3028 typename __TBB_B5,
typename __TBB_B6>
3030 unfolded_type(g, b0, b1, b2, b3, b4, b5, b6) {
3031 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3035 #if __TBB_VARIADIC_MAX >= 8 3036 template<
typename __TBB_B0,
typename __TBB_B1,
typename __TBB_B2,
typename __TBB_B3,
typename __TBB_B4,
3037 typename __TBB_B5,
typename __TBB_B6,
typename __TBB_B7>
3039 __TBB_B7 b7) : unfolded_type(g, b0, b1, b2, b3, b4, b5, b6, b7) {
3040 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3044 #if __TBB_VARIADIC_MAX >= 9 3045 template<
typename __TBB_B0,
typename __TBB_B1,
typename __TBB_B2,
typename __TBB_B3,
typename __TBB_B4,
3046 typename __TBB_B5,
typename __TBB_B6,
typename __TBB_B7,
typename __TBB_B8>
3048 __TBB_B7 b7, __TBB_B8 b8) : unfolded_type(g, b0, b1, b2, b3, b4, b5, b6, b7, b8) {
3049 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3053 #if __TBB_VARIADIC_MAX >= 10 3054 template<
typename __TBB_B0,
typename __TBB_B1,
typename __TBB_B2,
typename __TBB_B3,
typename __TBB_B4,
3055 typename __TBB_B5,
typename __TBB_B6,
typename __TBB_B7,
typename __TBB_B8,
typename __TBB_B9>
3057 __TBB_B7 b7, __TBB_B8 b8, __TBB_B9 b9) : unfolded_type(g, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9) {
3058 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3063 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3064 template <
typename... Args,
typename... Bodies>
3066 : join_node(nodes.graph_reference(), bodies...) {
3067 make_edges_in_order(nodes, *
this);
3072 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_JOIN_NODE_TAG_MATCHING, &this->
my_graph,
3076 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3093 template<
typename T0>
3096 static const int N = 1;
3102 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3106 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3107 template <
typename... Args>
3108 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3109 make_edges_in_order(nodes, *
this);
3115 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3119 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3126 template<
typename T0,
typename T1>
3129 static const int N = 2;
3135 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3139 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3140 template <
typename... Args>
3141 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3142 make_edges_in_order(nodes, *
this);
3148 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3152 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3159 template<
typename T0,
typename T1,
typename T2>
3162 static const int N = 3;
3168 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3172 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3173 template <
typename... Args>
3174 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3175 make_edges_in_order(nodes, *
this);
3181 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3185 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3192 template<
typename T0,
typename T1,
typename T2,
typename T3>
3195 static const int N = 4;
3201 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3205 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3206 template <
typename... Args>
3207 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3208 make_edges_in_order(nodes, *
this);
3214 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3218 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3225 template<
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
3228 static const int N = 5;
3234 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3238 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3239 template <
typename... Args>
3240 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3241 make_edges_in_order(nodes, *
this);
3247 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3251 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3258 #if __TBB_VARIADIC_MAX >= 6 3259 template<
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
3260 class indexer_node<T0, T1, T2, T3, T4, T5> :
public internal::unfolded_indexer_node<tuple<T0, T1, T2, T3, T4, T5> > {
3262 static const int N = 6;
3268 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3272 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3273 template <
typename... Args>
3274 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3275 make_edges_in_order(nodes, *
this);
3281 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3285 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3291 #endif //variadic max 6 3293 #if __TBB_VARIADIC_MAX >= 7 3294 template<
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
3296 class indexer_node<T0, T1, T2, T3, T4, T5, T6> :
public internal::unfolded_indexer_node<tuple<T0, T1, T2, T3, T4, T5, T6> > {
3298 static const int N = 7;
3304 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3308 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3309 template <
typename... Args>
3310 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3311 make_edges_in_order(nodes, *
this);
3317 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3321 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3327 #endif //variadic max 7 3329 #if __TBB_VARIADIC_MAX >= 8 3330 template<
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
3331 typename T6,
typename T7>
3332 class indexer_node<T0, T1, T2, T3, T4, T5, T6, T7> :
public internal::unfolded_indexer_node<tuple<T0, T1, T2, T3, T4, T5, T6, T7> > {
3334 static const int N = 8;
3340 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3344 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3345 template <
typename... Args>
3346 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3347 make_edges_in_order(nodes, *
this);
3353 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3357 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3363 #endif //variadic max 8 3365 #if __TBB_VARIADIC_MAX >= 9 3366 template<
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
3367 typename T6,
typename T7,
typename T8>
3368 class indexer_node<T0, T1, T2, T3, T4, T5, T6, T7, T8> :
public internal::unfolded_indexer_node<tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> > {
3370 static const int N = 9;
3376 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3380 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3381 template <
typename... Args>
3382 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3383 make_edges_in_order(nodes, *
this);
3389 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3393 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3399 #endif //variadic max 9 3401 #if __TBB_VARIADIC_MAX >= 10 3402 template<
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
3403 typename T6,
typename T7,
typename T8,
typename T9>
3406 static const int N = 10;
3408 typedef tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>
InputTuple;
3409 typedef typename internal::tagged_msg<size_t, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> output_type;
3412 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3416 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3417 template <
typename... Args>
3418 indexer_node(
const node_set<Args...>& nodes) : indexer_node(nodes.graph_reference()) {
3419 make_edges_in_order(nodes, *
this);
3425 tbb::internal::fgt_multiinput_node<N>(
CODEPTR(), tbb::internal::FLOW_INDEXER_NODE, &this->
my_graph,
3429 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3435 #endif //variadic max 10 3437 #if __TBB_PREVIEW_ASYNC_MSG 3440 template<
typename T >
3443 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 3444 s.internal_add_built_predecessor(p);
3445 p.internal_add_built_successor(s);
3452 template<
typename T >
3457 #if __TBB_PREVIEW_ASYNC_MSG 3458 template<
typename TS,
typename TR,
3465 template<
typename T >
3470 template<
typename T >
3475 #endif // __TBB_PREVIEW_ASYNC_MSG 3477 #if __TBB_FLOW_GRAPH_CPP11_FEATURES 3479 template<
typename T,
typename V,
3480 typename =
typename T::output_ports_type,
typename =
typename V::input_ports_type >
3482 make_edge(get<0>(output.output_ports()), get<0>(input.input_ports()));
3486 template<
typename T,
typename R,
3487 typename =
typename T::output_ports_type >
3489 make_edge(get<0>(output.output_ports()), input);
3493 template<
typename S,
typename V,
3494 typename =
typename V::input_ports_type >
3496 make_edge(output, get<0>(input.input_ports()));
3500 #if __TBB_PREVIEW_ASYNC_MSG 3503 template<
typename T >
3507 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 3509 p.internal_delete_built_successor(s);
3510 s.internal_delete_built_predecessor(p);
3516 template<
typename T >
3521 #if __TBB_PREVIEW_ASYNC_MSG 3522 template<
typename TS,
typename TR,
3529 template<
typename T >
3534 template<
typename T >
3538 #endif // __TBB_PREVIEW_ASYNC_MSG 3540 #if __TBB_FLOW_GRAPH_CPP11_FEATURES 3542 template<
typename T,
typename V,
3543 typename =
typename T::output_ports_type,
typename =
typename V::input_ports_type >
3545 remove_edge(get<0>(output.output_ports()), get<0>(input.input_ports()));
3549 template<
typename T,
typename R,
3550 typename =
typename T::output_ports_type >
3552 remove_edge(get<0>(output.output_ports()), input);
3555 template<
typename S,
typename V,
3556 typename =
typename V::input_ports_type >
3562 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 3563 template<
typename C >
3564 template<
typename S >
3565 void internal::edge_container<C>::sender_extract(
S &s ) {
3566 edge_list_type e = built_edges;
3567 for (
typename edge_list_type::iterator i = e.begin(); i != e.end(); ++i ) {
3572 template<
typename C >
3573 template<
typename R >
3574 void internal::edge_container<C>::receiver_extract( R &r ) {
3575 edge_list_type e = built_edges;
3576 for (
typename edge_list_type::iterator i = e.begin(); i != e.end(); ++i ) {
3583 template<
typename Body,
typename Node >
3585 return n.template copy_function_object<Body>();
3588 #if __TBB_FLOW_GRAPH_CPP11_FEATURES 3593 template<
typename... InputTypes,
typename... OutputTypes>
3604 static const size_t NUM_INPUTS =
sizeof...(InputTypes);
3605 static const size_t NUM_OUTPUTS =
sizeof...(OutputTypes);
3611 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3622 template<
typename T1,
typename T2>
3626 my_input_ports = tbb::internal::make_unique<input_ports_type>(std::forward<T1>(input_ports_tuple));
3627 my_output_ports = tbb::internal::make_unique<output_ports_type>(std::forward<T2>(output_ports_tuple));
3633 template<
typename... NodeTypes >
3636 template<
typename... NodeTypes >
3639 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3646 __TBB_ASSERT(my_input_ports,
"input ports not set, call set_external_ports to set input ports");
3647 return *my_input_ports;
3651 __TBB_ASSERT(my_output_ports,
"output ports not set, call set_external_ports to set output ports");
3652 return *my_output_ports;
3655 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 3657 __TBB_ASSERT(
false,
"Current composite_node implementation does not support extract");
3663 template<
typename... InputTypes>
3670 static const size_t NUM_INPUTS =
sizeof...(InputTypes);
3676 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3687 template<
typename T>
3691 my_input_ports = tbb::internal::make_unique<input_ports_type>(std::forward<T>(input_ports_tuple));
3696 template<
typename... NodeTypes >
3699 template<
typename... NodeTypes >
3702 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3709 __TBB_ASSERT(my_input_ports,
"input ports not set, call set_external_ports to set input ports");
3710 return *my_input_ports;
3713 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 3715 __TBB_ASSERT(
false,
"Current composite_node implementation does not support extract");
3722 template<
typename... OutputTypes>
3729 static const size_t NUM_OUTPUTS =
sizeof...(OutputTypes);
3735 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3746 template<
typename T>
3750 my_output_ports = tbb::internal::make_unique<output_ports_type>(std::forward<T>(output_ports_tuple));
3755 template<
typename... NodeTypes >
3758 template<
typename... NodeTypes >
3761 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3768 __TBB_ASSERT(my_output_ports,
"output ports not set, call set_external_ports to set output ports");
3769 return *my_output_ports;
3772 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 3774 __TBB_ASSERT(
false,
"Current composite_node implementation does not support extract");
3780 #endif // __TBB_FLOW_GRAPH_CPP11_FEATURES 3784 template<
typename Gateway>
3791 my_gateway = gateway;
3798 template<
typename Input,
typename Ports,
typename Gateway,
typename Body>
3805 : base_type(gateway), my_body(body) { }
3808 my_body(v, *this->my_gateway);
3820 namespace interface11 {
3823 template <
typename Input,
typename Output,
3847 try_put_functor(output_port_type &p,
const Output &v) : port(&p), value(&v), result(false) { }
3849 result = port->
try_put(*value);
3858 my_node->my_graph.reserve_wait();
3862 my_node->my_graph.release_wait();
3868 return my_node->try_put_impl(i);
3886 "Return status is inconsistent with the method operation." );
3888 while( !tasks.
empty() ) {
3892 return is_at_least_one_put_successful;
3896 template<
typename Body>
3898 graph &g,
size_t concurrency,
3906 internal::async_body<Input, typename base_type::output_ports_type, gateway_type, Body>
3908 tbb::internal::fgt_multioutput_node_with_body<1>(
3909 CODEPTR(), tbb::internal::FLOW_ASYNC_NODE,
3911 this->output_ports(), this->my_body
3915 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES && __TBB_CPP11_PRESENT 3916 template <
typename Body,
typename... Args>
3918 : async_node(g, concurrency, body, Policy(), priority) {}
3919 #endif // __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 3921 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3922 template <
typename Body,
typename... Args>
3924 const node_set<Args...>& nodes,
size_t concurrency, Body body,
3927 make_edges_in_order(nodes, *
this);
3930 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 3931 template <
typename Body,
typename... Args>
3933 : async_node(nodes, concurrency, body, Policy(), priority) {}
3934 #endif // __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 3935 #endif // __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 3938 static_cast<async_body_base_type*
>(this->my_body->get_body_ptr())->set_gateway(&my_gateway);
3939 static_cast<async_body_base_type*
>(this->my_init_body->get_body_ptr())->set_gateway(&my_gateway);
3941 tbb::internal::fgt_multioutput_node_with_body<1>(
CODEPTR(), tbb::internal::FLOW_ASYNC_NODE,
3943 this->output_ports(), this->my_body );
3950 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 3960 return internal::output_port<0>(*this).register_successor(r);
3965 return internal::output_port<0>(*this).remove_successor(r);
3968 template<
typename Body>
3972 mfn_body_type &body_ref = *this->my_body;
3977 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 3978 typedef typename internal::edge_container<successor_type> built_successors_type;
3980 typedef typename built_successors_type::edge_list_type successor_list_type;
3982 return internal::output_port<0>(*this).built_successors();
3985 void internal_add_built_successor( successor_type &r )
__TBB_override {
3986 internal::output_port<0>(*this).internal_add_built_successor(r);
3989 void internal_delete_built_successor( successor_type &r )
__TBB_override {
3990 internal::output_port<0>(*this).internal_delete_built_successor(r);
3994 internal::output_port<0>(*this).copy_successors(l);
3998 return internal::output_port<0>(*this).successor_count();
4005 base_type::reset_node(f);
4009 #if __TBB_PREVIEW_STREAMING_NODE 4011 #endif // __TBB_PREVIEW_STREAMING_NODE 4015 template<
typename T >
4022 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 4035 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 4036 template <
typename... Args>
4037 overwrite_node(
const node_set<Args...>& nodes) : overwrite_node(nodes.graph_reference()) {
4038 make_edges_in_order(nodes, *
this);
4053 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 4063 bool ret = s.
try_put( my_buffer );
4089 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 4090 built_predecessors_type &built_predecessors()
__TBB_override {
return my_built_predecessors; }
4091 built_successors_type &built_successors()
__TBB_override {
return my_successors.built_successors(); }
4093 void internal_add_built_successor( successor_type &s)
__TBB_override {
4095 my_successors.internal_add_built_successor(s);
4098 void internal_delete_built_successor( successor_type &s)
__TBB_override {
4100 my_successors.internal_delete_built_successor(s);
4105 return my_successors.successor_count();
4110 my_successors.copy_successors(v);
4113 void internal_add_built_predecessor( predecessor_type &p)
__TBB_override {
4115 my_built_predecessors.add_edge(p);
4118 void internal_delete_built_predecessor( predecessor_type &p)
__TBB_override {
4120 my_built_predecessors.delete_edge(p);
4125 return my_built_predecessors.edge_count();
4128 void copy_predecessors( predecessor_list_type &v )
__TBB_override {
4130 my_built_predecessors.copy_edges(v);
4134 my_buffer_is_valid =
false;
4135 built_successors().sender_extract(*
this);
4136 built_predecessors().receiver_extract(*
this);
4143 if ( my_buffer_is_valid ) {
4163 return my_buffer_is_valid;
4168 my_buffer_is_valid =
false;
4178 return try_put_task_impl(v);
4183 my_buffer_is_valid =
true;
4197 o(owner), s(succ) {};
4201 o.register_successor(s);
4206 predecessor_type&
o;
4212 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 4213 internal::edge_container<predecessor_type> my_built_predecessors;
4220 my_buffer_is_valid =
false;
4221 if (f&rf_clear_edges) {
4222 my_successors.
clear();
4227 template<
typename T >
4243 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 4244 template <
typename... Args>
4245 write_once_node(
const node_set<Args...>& nodes) : write_once_node(nodes.graph_reference()) {
4246 make_edges_in_order(nodes, *
this);
4257 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 4269 return this->my_buffer_is_valid ? NULL : this->try_put_task_impl(v);
4302 using namespace interface11::internal::graph_policy_namespace;
4309 #if __TBB_FLOW_GRAPH_CPP11_FEATURES 4313 #if __TBB_PREVIEW_ASYNC_MSG 4316 #if __TBB_PREVIEW_STREAMING_NODE 4319 #endif // __TBB_PREVIEW_STREAMING_NODE 4320 #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES 4325 #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET 4326 using interface11::internal::follows;
4327 using interface11::internal::precedes;
4328 using interface11::internal::make_node_set;
4329 using interface11::internal::make_edges;
4338 #undef __TBB_PFG_RESET_ARG 4342 #undef __TBB_flow_graph_H_include_area 4344 #if TBB_USE_THREADING_TOOLS && TBB_PREVIEW_FLOW_GRAPH_TRACE && ( __linux__ || __APPLE__ ) 4345 #undef __TBB_NOINLINE_SYM 4348 #endif // __TBB_flow_graph_H internal::continue_input< Output, Policy > input_impl_type
void add_visible_nodes(const NodeTypes &... n)
graph & graph_reference() const __TBB_override
internal::unfolded_indexer_node< InputTuple > unfolded_type
internal::source_body< output_type > * my_body
bool try_put(const X &t)
Put an item to the receiver.
__TBB_NOINLINE_SYM function_node(const function_node &src)
Copy constructor.
void reset_node(reset_flags f) __TBB_override
void reset_node(reset_flags f) __TBB_override
buffer_node< T, A > base_type
void reset_node(reset_flags f) __TBB_override
virtual bool try_reserve_wrapper(void *p, bool is_async) __TBB_override
unfolded_join_node : passes input_ports_type to join_node_base. We build the input port type ...
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1, __TBB_B2 b2, __TBB_B3 b3, __TBB_B4 b4, __TBB_B5 b5)
tbb::task_group_context * my_context
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1, __TBB_B2 b2, __TBB_B3 b3, __TBB_B4 b4)
interface11::internal::Policy< queueing, lightweight > queueing_lightweight
tbb::flow::tuple< receiver< InputTypes > &... > input_ports_type
receiver< input_type >::predecessor_type predecessor_type
void wait_for_all()
Wait until graph is idle and decrement_wait_count calls equals increment_wait_count calls...
Base class for types that should not be assigned.
void add_task_to_graph_reset_list(tbb::flow::interface10::graph &g, tbb::task *tp)
unfolded_type::input_ports_type input_ports_type
sender< output_type >::successor_type successor_type
input_ports_type & input_ports()
receiver< input_type >::predecessor_type predecessor_type
sender< output_type >::successor_type successor_type
task * try_put_task_impl(const input_type &v)
bool try_release() __TBB_override
Release a reserved item.
void reset_node(reset_flags f) __TBB_override
void add_nodes(const NodeTypes &... n)
internal::port_ref_impl< N1, N2 > port_ref()
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1, __TBB_B2 b2, __TBB_B3 b3, __TBB_B4 b4, __TBB_B5 b5, __TBB_B6 b6, __TBB_B7 b7, __TBB_B8 b8, __TBB_B9 b9)
tbb::task * execute() __TBB_override
Should be overridden by derived classes.
Implements methods for both executable and function nodes that puts Output to its successors...
void internal_remove_edge(internal::untyped_sender &p, internal::untyped_receiver &s)
void set_owner(owner_type *owner)
sender< output_type >::successor_type successor_type
iterator begin()
start iterator
__TBB_NOINLINE_SYM write_once_node(graph &g)
Constructor.
sender< output_type >::successor_type successor_type
~graph()
Destroys the graph.
virtual void internal_release(buffer_operation *op)
__TBB_DEPRECATED typedef continue_msg input_type
The input type.
bool try_get(output_type &v) __TBB_override
Request an item from the node.
__TBB_NOINLINE_SYM indexer_node(graph &g)
bool register_successor(successor_type &r) __TBB_override
Add a new successor to this node.
#define __TBB_DEPRECATED_LIMITER_ARG2(arg1, arg2)
bool try_consume() __TBB_override
Consumes the reserved item.
__TBB_NOINLINE_SYM multifunction_node(graph &g, size_t concurrency,)
__TBB_NOINLINE_SYM write_once_node(const write_once_node &src)
Copy constructor: call base class copy constructor.
T::async_msg_data_type filtered_type
tbb::flow::tuple< sender< OutputTypes > &... > output_ports_type
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)
buffer_operation(op_type t)
tuple< T0, T1, T2, T3, T4 > InputTuple
#define __TBB_NOINLINE_SYM
virtual bool try_reserve(T &)
Reserves an item in the sender.
void add_nodes(const NodeTypes &... n)
buffer_node< T, A >::size_type size_type
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1)
virtual ~untyped_receiver()
Destructor.
__TBB_NOINLINE_SYM join_node(graph &g)
__TBB_NOINLINE_SYM join_node(const join_node &other)
virtual bool try_get_wrapper(void *p, bool is_async) __TBB_override
void reset_receiver(reset_flags) __TBB_override
put receiver back in initial state
void prepare_task_arena(bool reinit=false)
void set_gateway(gateway_type *gateway)
void activate()
Activates a node that was created in the inactive state.
__TBB_NOINLINE_SYM broadcast_node(const broadcast_node &src)
internal::unfolded_indexer_node< InputTuple > unfolded_type
#define __TBB_DEPRECATED_LIMITER_ARG4(arg1, arg2, arg3, arg4)
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
static void fgt_graph(void *)
__TBB_NOINLINE_SYM indexer_node(graph &g)
void internal_forward_task_impl(buffer_operation *op, derived_type *derived)
void __TBB_store_with_release(volatile T &location, V value)
#define __TBB_FLOW_GRAPH_PRIORITY_ARG0(priority)
internal::function_output< output_type > fOutput_type
void add(untyped_sender &n)
std::unique_ptr< output_ports_type > my_output_ports
bool register_predecessor(predecessor_type &src) __TBB_override
Adds src to the list of cached predecessors.
task * try_put_task(const X &t)
static const void * to_void_ptr(const T &t)
virtual bool register_successor(successor_type &r)=0
Add a new successor to this node.
void add_visible_nodes(const NodeTypes &... n)
void reset_node(reset_flags f) __TBB_override
resets the source_node to its initial state
unfolded_type::input_ports_type input_ports_type
bool register_successor(successor_type &s) __TBB_override
Add a new successor to this node.
bool is_graph_active(tbb::flow::interface10::graph &g)
virtual graph & graph_reference() const =0
unfolded_type::input_ports_type input_ports_type
virtual bool remove_predecessor(predecessor_type &)
Remove a predecessor from the node.
sender< output_type >::successor_type successor_type
output_ports_type & output_ports()
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)
bool try_reserve(X &t)
Reserves an item in the sender.
static const node_priority_t no_priority
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp begin
Implements methods for an executable node that takes continue_msg as input.
tbb::flow::tuple< sender< OutputTypes > &... > output_ports_type
task * try_put_task(const T &t) __TBB_override
receive an item, return a task *if possible
void internal_forward_task(queue_operation *op) __TBB_override
Tries to forward valid items to successors.
virtual bool try_get(T &)
Request an item from the sender.
const V & cast_to(T const &t)
internal::tagged_msg< size_t, T0, T1, T2, T3 > output_type
void remove(untyped_sender &n)
try_put_functor(output_port_type &p, const Output &v)
__TBB_NOINLINE_SYM indexer_node(graph &g)
internal::unfolded_indexer_node< InputTuple > unfolded_type
bool try_put(const typename internal::async_helpers< T >::filtered_type &t)
Put an item to the receiver.
tbb::flow::interface11::graph_iterator< graph, tbb::flow::interface11::graph_node > iterator
__TBB_NOINLINE_SYM async_node(const async_node &other)
receiver< input_type > receiver_type
bool gather_successful_try_puts(const X &t, task_list &tasks)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id parent
void add_nodes(const NodeTypes &... n)
task & pop_front()
Pop the front task from the list.
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
__TBB_NOINLINE_SYM async_node(graph &g, size_t concurrency,)
bool remove_successor(successor_type &r) __TBB_override
Removes a successor.
virtual bool try_release()
Releases the reserved item.
reference operator*() const
Dereference.
bool try_reserve_apply_body(output_type &v)
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1, __TBB_B2 b2, __TBB_B3 b3, __TBB_B4 b4, __TBB_B5 b5, __TBB_B6 b6, __TBB_B7 b7, __TBB_B8 b8)
bool try_release() __TBB_override
Release a reserved item.
virtual void finalize() const
task * try_put_task(const T &v) __TBB_override
Put item to successor; return task to run the successor if possible.
void reset_node(reset_flags f) __TBB_override
pointer operator->() const
Dereference.
graph & graph_reference() const __TBB_override
bool register_successor(successor_type &r) __TBB_override
Adds a new successor.
static void alias_port(void *, PortsTuple &)
void set_ref_count(int count)
Set reference count.
tuple< T0, T1, T2, T3, T4, T5 > InputTuple
An empty class used for messages that mean "I'm done".
internal::tagged_msg< size_t, T0, T1, T2, T3, T4, T5, T6, T7 > output_type
task * try_put_task(const T &t) __TBB_override
build a task to run the successor if possible. Default is old behavior.
__TBB_NOINLINE_SYM composite_node(graph &g)
bool try_put(const output_type &i)
untyped_receiver successor_type
The successor type for this node.
task * try_put_task(const X &t)
task * grab_forwarding_task(buffer_operation &op_data)
#define __TBB_CPP11_PRESENT
static void fgt_make_edge(void *, void *)
overwrite_node< T > base_type
bool remove_successor(successor_type &r) __TBB_override
Removes a successor from this node.
__TBB_NOINLINE_SYM continue_node(const continue_node &src)
Copy constructor.
broadcast_cache_type & successors()
int decrement_ref_count()
Atomically decrement reference count and returns its new value.
void __TBB_EXPORTED_METHOD reset()
Forcefully reinitializes the context after the task tree it was associated with is completed...
sender< output_type >::successor_type successor_type
The type of successors of this node.
__TBB_NOINLINE_SYM indexer_node(graph &g)
void reset_node(reset_flags) __TBB_override
void reset_node(reset_flags f) __TBB_override
static void * to_void_ptr(T &t)
__TBB_DEPRECATED typedef receiver< input_type >::predecessor_type predecessor_type
The predecessor type for this node.
void reserve_wait() __TBB_override
Inform a graph that messages may come from outside, to prevent premature graph completion.
tbb::task_arena * my_task_arena
fOutput_type::successor_type successor_type
internal::tagged_msg< size_t, T0, T1, T2 > output_type
static void fgt_composite(void *, void *, void *)
static void fgt_remove_edge(void *, void *)
__TBB_NOINLINE_SYM indexer_node(graph &g)
tuple< T0, T1, T2, T3, T4, T5, T6, T7 > InputTuple
void reset_node(reset_flags) __TBB_override
graph & graph_reference() const __TBB_override
void prio_push(const T &src)
internal::unfolded_join_node< N, key_matching_port, OutputTuple, key_matching< K, KHash > > unfolded_type
buffer_node< T, A > base_type
bool try_reserve(T &v) __TBB_override
Reserves an item.
virtual void internal_reg_succ(buffer_operation *op)
Register successor.
bool try_put(const Output &i) __TBB_override
Implements gateway_type::try_put for an external activity to submit a message to FG.
internal::function_body< T, size_t > * my_sequencer
buffer_node< T, A >::buffer_operation sequencer_operation
__TBB_NOINLINE_SYM split_node(const split_node &other)
static tbb::task *const SUCCESSFULLY_ENQUEUED
An abstract cache of successors.
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)
static void fgt_node_desc(const NodeType *, const char *)
bool try_consume() __TBB_override
Consumes a reserved item.
virtual void reset_node(reset_flags f=rf_reset_protocol)=0
task * decrement_counter(long long delta)
bool try_get(X &t)
Request an item from the sender.
Implements an executable node that supports continue_msg -> Output.
concurrency
An enumeration the provides the two most common concurrency levels: unlimited and serial...
internal::function_input< input_type, output_type, Policy, Allocator > input_impl_type
fOutput_type::successor_type successor_type
tbb::task * root_task()
Returns the root task of the graph.
virtual void internal_rem_succ(buffer_operation *op)
Remove successor.
receiver< input_type >::predecessor_type predecessor_type
__TBB_NOINLINE_SYM overwrite_node(const overwrite_node &src)
Copy constructor; doesn't take anything from src; default won't work.
void call(F &&f, Pack &&p)
Calls the given function with arguments taken from a stored_pack.
__TBB_NOINLINE_SYM buffer_node(const buffer_node &src)
Copy constructor.
virtual ~untyped_sender()
static void fgt_reserve_wait(void *)
internal::tagged_msg< size_t, T0, T1, T2, T3, T4, T5 > output_type
limiter_node(graph &g, __TBB_DEPRECATED_LIMITER_ARG2(size_t threshold, int num_decrement_predecessors=0))
Constructor.
async_body_base(gateway_type *gateway)
bool try_reserve(output_type &v) __TBB_override
Reserves an item.
Detects whether two given types are the same.
bool try_put_impl(const Output &i)
Implements gateway_type::try_put for an external activity to submit a message to FG.
static void fgt_async_commit(void *, void *)
#define __TBB_STATIC_ASSERT(condition, msg)
static void fgt_begin_body(void *)
void internal_reserve(queue_operation *op) __TBB_override
static T & from_void_ptr(void *p)
internal::broadcast_cache< output_type > my_successors
static void fgt_async_try_put_end(void *, void *)
void add_visible_nodes(const NodeTypes &... n)
static void fgt_multioutput_node_desc(const NodeType *, const char *)
__TBB_NOINLINE_SYM join_node(const join_node &other)
tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 > InputTuple
internal::unfolded_indexer_node< InputTuple > unfolded_type
buffer_node< T, A >::size_type size_type
__TBB_NOINLINE_SYM queue_node(graph &g)
Constructor.
bool try_reserve(output_type &v)
virtual source_body * clone()=0
receiver< input_type >::predecessor_type predecessor_type
static void clear_this(P &p)
leaf for multifunction. OutputSet can be a std::tuple or a vector.
internal::tagged_msg< size_t, T0, T1, T2, T3, T4, T5, T6, T7, T8 > output_type
virtual bool try_consume()
Consumes the reserved item.
void const char const char int ITT_FORMAT __itt_group_sync x void const char * name
void internal_pop(prio_operation *op) __TBB_override
Forwards messages in sequence order.
void reset(tbb::flow::interface11::reset_flags f=tbb::flow::interface11::rf_reset_protocol)
task * apply_body_bypass()
Applies the body. Returning SUCCESSFULLY_ENQUEUED okay; forward_task_bypass will handle it...
void try_put_and_add_task(task *&last_task)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark S
internal::function_output< output_type > fOutput_type
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1, __TBB_B2 b2, __TBB_B3 b3)
__TBB_NOINLINE_SYM sequencer_node(const sequencer_node &src)
Copy constructor.
#define __TBB_FLOW_GRAPH_PRIORITY_ARG1(arg1, priority)
virtual void handle_operations(buffer_operation *op_list)
receiver< input_type >::predecessor_type predecessor_type
async_storage_ptr my_storage
Body copy_body(Node &n)
Returns a copy of the body from a function or continue node.
virtual bool internal_push(buffer_operation *op)
void internal_consume(prio_operation *op) __TBB_override
__TBB_NOINLINE_SYM join_node(const join_node &other)
__TBB_NOINLINE_SYM join_node(graph &g)
void fgt_multiinput_multioutput_node_desc(const NodeType *, const char *)
internal::wrap_tuple_elements< N, internal::multifunction_output, TupleType >::type output_ports_type
graph()
Constructs a graph with isolated task_group_context.
bool try_consume() __TBB_override
Consumes a reserved item.
__TBB_NOINLINE_SYM priority_queue_node(const priority_queue_node &src)
Copy constructor.
void set_owner(successor_type *owner)
void reset_node(reset_flags f) __TBB_override
internal::aggregator< handler_type, buffer_operation > my_aggregator
A lock that occupies a single byte.
void internal_pop(queue_operation *op) __TBB_override
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
void reset_receiver(reset_flags f) __TBB_override
put receiver back in initial state
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1, __TBB_B2 b2, __TBB_B3 b3, __TBB_B4 b4, __TBB_B5 b5, __TBB_B6 b6, __TBB_B7 b7)
void reserve_wait() __TBB_override
Used to register that an external entity may still interact with the graph.
gateway_type * my_gateway
task * try_put_task(const T &t) __TBB_override
void reset_node(reset_flags) __TBB_override
void const char const char int ITT_FORMAT __itt_group_sync s
Pure virtual template class that defines a receiver of messages of type T.
__TBB_NOINLINE_SYM split_node(graph &g)
sender< output_type >::successor_type successor_type
bool internal_push(prio_operation *op) __TBB_override
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Implements a function node that supports Input -> Output.
iterator end()
end iterator
virtual void internal_pop(buffer_operation *op)
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)
receiver< input_type >::predecessor_type predecessor_type
A task that calls a node's forward_task function.
virtual void internal_consume(buffer_operation *op)
task_list_type my_reset_task_list
internal::unfolded_join_node< N, reserving_port, OutputTuple, reserving > unfolded_type
untyped_sender predecessor_type
The predecessor type for this node.
internal::broadcast_cache< output_type > & successors() __TBB_override
wrap_tuple_elements< N, PT, OutputTuple >::type input_ports_type
tuple< T0, T1, T2, T3 > InputTuple
internal::unfolded_join_node< N, queueing_port, OutputTuple, queueing > unfolded_type
tbb::flow::interface11::graph_iterator< const graph, const tbb::flow::interface11::graph_node > const_iterator
async_body(const Body &body, gateway_type *gateway)
const_iterator cbegin() const
start const iterator
internal::unfolded_indexer_node< InputTuple > unfolded_type
std::unique_ptr< output_ports_type > my_output_ports
std::unique_ptr< input_ports_type > my_input_ports
__TBB_NOINLINE_SYM indexer_node(graph &g)
__TBB_NOINLINE_SYM continue_node(graph &g,)
Constructor for executable node with continue_msg -> Output.
int my_initial_predecessor_count
void remove_successor(successor_type &r)
static void alias_port(void *, PortsTuple &)
tuple< T0, T1 > InputTuple
const_iterator cend() const
end const iterator
task that does nothing. Useful for synchronization.
void set_external_ports(T &&output_ports_tuple)
graph & graph_reference() const __TBB_override
__TBB_NOINLINE_SYM buffer_node(graph &g)
Constructor.
bool remove_successor(successor_type &r) __TBB_override
Removes s as a successor.
void set_external_ports(T1 &&input_ports_tuple, T2 &&output_ports_tuple)
virtual bool remove_successor(successor_type &r)=0
Removes a successor from this node.
void handle_operations(prio_operation *op_list) __TBB_override
static const T & from_void_ptr(const void *p)
tbb::flow::tuple< receiver< InputTypes > &... > input_ports_type
limiter_node(const limiter_node &src)
Copy constructor.
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1, __TBB_B2 b2, __TBB_B3 b3, __TBB_B4 b4, __TBB_B5 b5, __TBB_B6 b6)
void increment_ref_count()
Atomically increment reference count.
bool is_continue_receiver() __TBB_override
task * try_put_task(const input_type &) __TBB_override
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)
A cache of successors that are put in a round-robin fashion.
internal::source_body< output_type > * my_init_body
void operator()(const Input &v, Ports &)
internal::round_robin_cache< T, null_rw_mutex > my_successors
internal::unfolded_indexer_node< InputTuple > unfolded_type
multifunction_node< Input, tuple< Output >, Policy, Allocator > base_type
#define __TBB_FLOW_GRAPH_PRIORITY_EXPR(expr)
Forwards messages in arbitrary order.
Implements methods for a function node that takes a type Input as input.
Output output_type
The type of the output message, which is complete.
Breaks an infinite loop between the node reservation and register_successor call. ...
graph & graph_reference() const __TBB_override
tuple< T0, T1, T2 > InputTuple
base_type::size_type size_type
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)
tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8 > InputTuple
receiver_type::predecessor_type predecessor_type
split_node: accepts a tuple as input, forwards each element of the tuple to its
__TBB_DEPRECATED bool register_predecessor(predecessor_type &) __TBB_override
Increments the trigger threshold.
Body copy_function_object()
void spawn_put()
Spawns a task that applies the body.
Base class for tasks generated by graph nodes.
void internal_reserve(prio_operation *op) __TBB_override
__TBB_DEPRECATED bool remove_predecessor(predecessor_type &) __TBB_override
Decrements the trigger threshold.
buffer_node< T, A >::buffer_operation prio_operation
field of type K being used for matching.
Forward declaration section.
void try_put_and_add_task(task *&last_task)
output_type my_cached_item
tbb::flow::interface11::graph_node * my_nodes
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
An executable node that acts as a source, i.e. it has no predecessors.
internal::function_input_queue< input_type, Allocator > input_queue_type
void release_wait() __TBB_override
Inform a graph that a previous call to reserve_wait is no longer in effect.
The base of all graph nodes.
static void fgt_async_try_put_begin(void *, void *)
__TBB_NOINLINE_SYM function_node(graph &g, size_t concurrency, __TBB_FLOW_GRAPH_PRIORITY_ARG1(Body body, node_priority_t priority=tbb::flow::internal::no_priority))
Constructor.
task * try_put_task(const input_type &v) __TBB_override
Put item to successor; return task to run the successor if possible.
__TBB_DEPRECATED continue_receiver(const continue_receiver &src)
Copy constructor.
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)
void deactivate_graph(tbb::flow::interface10::graph &g)
~sequencer_node()
Destructor.
tuple< T0, T1, T2, T3, T4, T5, T6 > InputTuple
sender< output_type >::successor_type successor_type
void reset_receiver(reset_flags) __TBB_override
put receiver back in initial state
virtual task * forward_task()
This is executed by an enqueued task, the "forwarder".
internal::tagged_msg< size_t, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 > output_type
bool remove_successor(successor_type &r) __TBB_override
Removes a successor from this node.
__TBB_NOINLINE_SYM indexer_node(graph &g)
std::unique_ptr< input_ports_type > my_input_ports
bool empty() const
True if list is empty; false otherwise.
bool register_successor(successor_type &r) __TBB_override
Add a new successor to this node.
void reset_receiver(reset_flags) __TBB_override
put receiver back in initial state
internal::decrementer< limiter_node< T, DecrementType >, DecrementType > decrement
The internal receiver< DecrementType > that decrements the count.
unsigned int node_priority_t
virtual task * try_put_task_wrapper(const void *p, bool is_async) __TBB_override
static void fgt_graph_desc(void *, const char *)
virtual bool register_predecessor(predecessor_type &)
Add a predecessor to the node.
void activate_graph(tbb::flow::interface10::graph &g)
bool try_reserve(T &v) __TBB_override
Reserves an item.
void register_successor(successor_type &r)
buffer_node< T, A >::item_type item_type
void reset_node(reset_flags f) __TBB_override
task * try_put_task(const TupleType &t) __TBB_override
Put item to successor; return task to run the successor if possible.
internal::unfolded_indexer_node< InputTuple > unfolded_type
bool try_release() __TBB_override
Releases the reserved item.
async_body_base< Gateway > base_type
~source_node()
The destructor.
output_ports_type my_output_ports
receiver< input_type >::predecessor_type predecessor_type
void enqueue_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Enqueues a task inside graph arena.
void register_node(tbb::flow::interface11::graph_node *n)
output_ports_type & output_ports()
static void fgt_release_wait(void *)
K key_from_message(const T &t)
function_body that takes an Input and a set of output ports
An cache of predecessors that supports requests and reservations.
receiver< TupleType > base_type
void reset_receiver(reset_flags) __TBB_override
put receiver back in initial state
receiver_gateway_impl(async_node *node)
Forwards messages in FIFO order.
Represents acquisition of a mutex.
internal::function_input_queue< input_type, Allocator > input_queue_type
internal::multifunction_input< Input, typename base_type::output_ports_type, Policy, Allocator > mfn_input_type
bool remove_successor(successor_type &s) __TBB_override
Removes a successor from this node.
tbb::spin_mutex nodelist_mutex
void reset_node(reset_flags f) __TBB_override
base_type::output_ports_type output_ports_type
virtual void internal_reserve(buffer_operation *op)
A cache of successors that are broadcast to.
internal::async_body_base< gateway_type > async_body_base_type
input_impl_type::predecessor_type predecessor_type
void internal_forward_task(prio_operation *op) __TBB_override
Tries to forward valid items to successors.
indexer_node(const indexer_node &other)
bool remove_successor(successor_type &r) __TBB_override
Removes a successor from this node.
Forwards messages of type T to all successors.
internal::aggregating_functor< class_type, buffer_operation > handler_type
static void fgt_node(void *, string_index, void *, void *)
__TBB_NOINLINE_SYM overwrite_node(graph &g)
void try_put_and_add_task(task *&last_task)
__TBB_NOINLINE_SYM indexer_node(graph &g)
static void * to_void_ptr(T &t)
void release_wait() __TBB_override
Deregisters an external entity that may have interacted with the graph.
internal::multifunction_input< input_type, output_ports_type, Policy, Allocator > base_type
internal::reservable_predecessor_cache< T, spin_mutex > my_predecessors
void remove_node(tbb::flow::interface11::graph_node *n)
The leaf for source_body.
__TBB_NOINLINE_SYM indexer_node(graph &g)
Forwards messages only if the threshold has not been reached.
Used to form groups of tasks.
void remove_edge(sender< T > &p, receiver< T > &s)
Removes an edge between a single predecessor and a single successor.
__TBB_NOINLINE_SYM queue_node(const queue_node &src)
Copy constructor.
static task * try_put_task_wrapper_impl(receiver< T > *const this_recv, const void *p, bool is_async)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
implements a function node that supports Input -> (set of outputs)
base_type::buffer_operation queue_operation
internal::multifunction_input< input_type, output_ports_type, Policy, Allocator > input_impl_type
static void fgt_multiinput_multioutput_node(void *, string_index, void *, void *)
static T & from_void_ptr(void *p)
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)
__TBB_NOINLINE_SYM multifunction_node(const multifunction_node &other)
void handle_operations_impl(buffer_operation *op_list, derived_type *derived)
void internal_consume(queue_operation *op) __TBB_override
static void fgt_async_reserve(void *, void *)
receiver_gateway< output_type > gateway_type
GraphNodeType & reference
virtual task * try_put_task(const T &t)=0
Put item to successor; return task to run the successor if possible.
bool try_get(input_type &v) __TBB_override
Request an item from the sender.
internal::broadcast_cache< T > my_successors
task * try_put_task(const T &t) __TBB_override
Puts an item to this receiver.
__TBB_NOINLINE_SYM continue_node(graph &g, int number_of_predecessors,)
Constructor for executable node with continue_msg -> Output.
A task that calls a node's apply_body_bypass function with no input.
void reset_node(reset_flags f) __TBB_override
tbb::internal::uint64_t tag_value
__TBB_NOINLINE_SYM priority_queue_node(graph &g, const Compare &comp=Compare())
Constructor.
#define __TBB_DEPRECATED_LIMITER_EXPR(expr)
internal::tagged_msg< size_t, T0, T1, T2, T3, T4, T5, T6 > output_type
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock
input_impl_type::predecessor_type predecessor_type
tbb::flow::tuple_element< N, typename JNT::input_ports_type >::type & input_port(JNT &jn)
templated function to refer to input ports of the join node
static void fgt_node_with_body(void *, string_index, void *, void *, void *)
internal::wrap_tuple_elements< N, internal::multifunction_output, Output >::type output_ports_type
output_ports_type & output_ports()
bool internal_push(sequencer_operation *op) __TBB_override
item_buffer with reservable front-end. NOTE: if reserving, do not
internal::unfolded_indexer_node< InputTuple > unfolded_type
void reset_receiver(reset_flags) __TBB_override
put receiver back in initial state
__TBB_NOINLINE_SYM source_node(graph &g, Body body, bool is_active=true)
Constructor for a node with a successor.
Forwards messages in priority order.
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
bool try_put(const typename internal::async_helpers< T >::async_type &t)
void const char const char int ITT_FORMAT __itt_group_sync p
sender< output_type >::successor_type successor_type
A cache of predecessors that only supports try_get.
internal::unfolded_indexer_node< InputTuple > unfolded_type
__TBB_NOINLINE_SYM join_node(graph &g, __TBB_B0 b0, __TBB_B1 b1, __TBB_B2 b2)
Body copy_function_object()
internal::tagged_msg< size_t, T0, T1 > output_type
internal::unfolded_indexer_node< InputTuple > unfolded_type
void internal_release(prio_operation *op) __TBB_override
bool remove_predecessor(predecessor_type &src) __TBB_override
Removes src from the list of cached predecessors.
Base class for user-defined tasks.
tbb::flow::interface11::graph_node * my_nodes_last
void set_external_ports(T &&input_ports_tuple)
static void fgt_end_body(void *)
internal::broadcast_cache< input_type, null_rw_mutex > my_successors
Enables one or the other code branches.
void internal_make_edge(internal::untyped_sender &p, internal::untyped_receiver &s)
priority_queue_node class_type
task * try_put_task(const X &t)
internal::multifunction_output< Output > output_port_type
register_predecessor_task(predecessor_type &owner, successor_type &succ)
tbb::flow::tuple_element< N, typename MOP::output_ports_type >::type & output_port(MOP &op)
__TBB_NOINLINE_SYM sequencer_node(graph &g, const Sequencer &s)
Constructor.
static task * emit_this(graph &g, const T &t, P &p)
void add_nodes_impl(CompositeType *, bool)
void make_edge(sender< T > &p, receiver< T > &s)
Makes an edge between a single predecessor and a single successor.
internal::tagged_msg< size_t, T0 > output_type
__TBB_DEPRECATED continue_receiver(__TBB_FLOW_GRAPH_PRIORITY_ARG1(int number_of_predecessors, node_priority_t priority))
Constructor.
static const void * to_void_ptr(const T &t)
sender< output_type >::successor_type successor_type
internal::tagged_msg< size_t, T0, T1, T2, T3, T4 > output_type
Implements methods for a function node that takes a type Input as input and sends.
bool try_get(T &v) __TBB_override
Request an item from the buffer_node.
bool register_successor(successor_type &r) __TBB_override
Replace the current successor with this new successor.
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
Base class for receivers of completion messages.
input_ports_type & input_ports()
virtual task * execute()=0
Should be overridden by derived classes.
__TBB_NOINLINE_SYM indexer_node(const indexer_node &other)