17 #ifndef __TBB__flow_graph_indexer_impl_H 18 #define __TBB__flow_graph_indexer_impl_H 20 #ifndef __TBB_flow_graph_H 21 #error Do not #include this internal file directly; use public TBB headers instead. 33 template<
typename IndexerNodeBaseType,
typename T,
size_t K>
35 typename IndexerNodeBaseType::output_type o(K, v);
36 return reinterpret_cast<IndexerNodeBaseType *
>(
p)->try_put_task(&o);
39 template<
typename TupleTypes,
int N>
41 template<
typename IndexerNodeBaseType,
typename PortTuple>
43 typedef typename tuple_element<N-1, TupleTypes>
::type T;
44 task *(*indexer_node_put_task)(
const T&,
void *) = do_try_put<IndexerNodeBaseType, T, N-1>;
45 tbb::flow::get<N-1>(my_input).set_up(p, indexer_node_put_task, g);
46 indexer_helper<TupleTypes,N-1>::template set_indexer_node_pointer<IndexerNodeBaseType,PortTuple>(my_input,
p, g);
48 template<
typename InputTuple>
51 tbb::flow::get<N-1>(my_input).reset_receiver(f);
53 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 54 template<
typename InputTuple>
55 static inline void extract(InputTuple &my_input) {
57 tbb::flow::get<N-1>(my_input).extract_receiver();
62 template<
typename TupleTypes>
64 template<
typename IndexerNodeBaseType,
typename PortTuple>
67 task *(*indexer_node_put_task)(
const T&,
void *) = do_try_put<IndexerNodeBaseType, T, 0>;
68 tbb::flow::get<0>(my_input).set_up(p, indexer_node_put_task, g);
70 template<
typename InputTuple>
72 tbb::flow::get<0>(my_input).reset_receiver(f);
74 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 75 template<
typename InputTuple>
76 static inline void extract(InputTuple &my_input) {
77 tbb::flow::get<0>(my_input).extract_receiver();
86 typedef task* (* forward_function_ptr)(T
const &,
void* );
88 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 89 spin_mutex my_pred_mutex;
90 typedef typename receiver<T>::built_predecessors_type built_predecessors_type;
91 built_predecessors_type my_built_predecessors;
95 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 100 void set_up(
void*
p, forward_function_ptr f, graph& g) {
105 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 106 typedef typename receiver<T>::predecessor_list_type predecessor_list_type;
107 typedef typename receiver<T>::predecessor_type predecessor_type;
109 built_predecessors_type &built_predecessors()
__TBB_override {
return my_built_predecessors; }
112 spin_mutex::scoped_lock l(my_pred_mutex);
113 return my_built_predecessors.edge_count();
115 void internal_add_built_predecessor(predecessor_type &
p)
__TBB_override {
116 spin_mutex::scoped_lock l(my_pred_mutex);
117 my_built_predecessors.add_edge(p);
119 void internal_delete_built_predecessor(predecessor_type &p)
__TBB_override {
120 spin_mutex::scoped_lock l(my_pred_mutex);
121 my_built_predecessors.delete_edge(p);
123 void copy_predecessors( predecessor_list_type &v)
__TBB_override {
124 spin_mutex::scoped_lock l(my_pred_mutex);
125 my_built_predecessors.copy_edges(v);
129 template<
typename R,
typename B >
friend class run_and_put_task;
133 return my_try_put_task(v, my_indexer_ptr);
141 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 147 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 148 void extract_receiver() { my_built_predecessors.receiver_extract(*
this); }
152 template<
typename InputTuple,
typename OutputType,
typename StructTypes>
168 template<
typename InputTuple,
typename OutputType,
typename StructTypes>
170 public sender<OutputType> {
172 using graph_node::my_graph;
179 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 180 typedef typename sender<output_type>::built_successors_type built_successors_type;
181 typedef typename sender<output_type>::successor_list_type successor_list_type;
186 enum op_type { reg_succ, rem_succ, try__put_task
187 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 188 , add_blt_succ, del_blt_succ,
189 blt_succ_cnt, blt_succ_cpy
201 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 203 successor_list_type *succv;
207 type(char(t)), my_arg(e) {}
209 my_succ(const_cast<successor_type *>(&s)) {}
221 op_list = op_list->
next;
222 switch(current->
type) {
225 my_successors.register_successor(*(current->
my_succ));
230 my_successors.remove_successor(*(current->
my_succ));
233 case try__put_task: {
234 current->
bypass_t = my_successors.try_put_task(*(current->
my_arg));
238 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 240 my_successors.internal_add_built_successor(*(current->
my_succ));
244 my_successors.internal_delete_built_successor(*(current->
my_succ));
248 current->cnt_val = my_successors.successor_count();
252 my_successors.copy_successors(*(current->succv));
263 my_successors.set_owner(
this);
269 my_successors.set_owner(
this);
275 my_aggregator.
execute(&op_data);
281 my_aggregator.
execute(&op_data);
287 my_aggregator.
execute(&op_data);
291 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 293 built_successors_type &built_successors()
__TBB_override {
return my_successors.built_successors(); }
295 void internal_add_built_successor( successor_type &r)
__TBB_override {
297 my_aggregator.
execute(&op_data);
300 void internal_delete_built_successor( successor_type &r)
__TBB_override {
302 my_aggregator.
execute(&op_data);
307 my_aggregator.
execute(&op_data);
308 return op_data.cnt_val;
314 my_aggregator.
execute(&op_data);
317 my_successors.built_successors().sender_extract(*
this);
324 my_successors.clear();
336 template<
typename InputTuple>
342 template<
typename InputTuple>
349 template<
typename InputTuple>
357 template<
typename InputTuple>
367 template<
typename InputTuple>
378 template<
typename InputTuple>
387 fourth_type, fifth_type, sixth_type>
type;
390 template<
typename InputTuple>
400 fourth_type, fifth_type, sixth_type,
405 template<
typename InputTuple>
416 fourth_type, fifth_type, sixth_type,
417 seventh_type, eighth_type>
type;
421 template<
typename InputTuple>
433 fourth_type, fifth_type, sixth_type,
434 seventh_type, eighth_type, nineth_type>
type;
437 template<
typename InputTuple>
450 fourth_type, fifth_type, sixth_type,
451 seventh_type, eighth_type, nineth_type,
456 template<
typename OutputTuple>
465 template<
class OutputTuple>
tuple_element< 0, InputTuple >::type first_type
output_type const * my_arg
bool register_successor(successor_type &r) __TBB_override
Add a new successor to this node.
tuple_element< 3, InputTuple >::type fourth_type
tuple_element< 0, InputTuple >::type first_type
tuple_element< 7, InputTuple >::type eighth_type
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type, seventh_type, eighth_type > type
forward_function_ptr my_try_put_task
tuple_element< 3, InputTuple >::type fourth_type
task * try_put_task(output_type const *v)
tuple_element< 0, InputTuple >::type first_type
tuple_element< 4, InputTuple >::type fifth_type
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type > type
tuple_element< 3, InputTuple >::type fourth_type
tuple_element< 6, InputTuple >::type seventh_type
sender< output_type >::successor_type successor_type
tuple_element< 1, InputTuple >::type second_type
graph & graph_reference() const __TBB_override
tuple_element< 3, InputTuple >::type fourth_type
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type, seventh_type > type
indexer_node_base(const indexer_node_base &other)
void reset_node(reset_flags f) __TBB_override
A cache of successors that are broadcast to.
indexer_types< OutputTuple >::output_type output_type
tuple_element< 1, InputTuple >::type second_type
void __TBB_store_with_release(volatile T &location, V value)
tuple_element< 2, InputTuple >::type third_type
tuple_element< 6, InputTuple >::type seventh_type
tuple_element< 3, InputTuple >::type fourth_type
tuple_element< 4, InputTuple >::type fifth_type
void execute(operation_type *op)
static void set_indexer_node_pointer(PortTuple &my_input, IndexerNodeBaseType *p, graph &g)
tuple_element< 5, InputTuple >::type sixth_type
aggregator< handler_type, indexer_node_base_operation > my_aggregator
tuple_element< 8, InputTuple >::type nineth_type
tuple_element< 6, InputTuple >::type seventh_type
tuple_element< 2, InputTuple >::type third_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 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
input_types< N, OutputTuple >::type output_type
input_type & input_ports()
tuple_element< 1, InputTuple >::type second_type
tuple_element< 4, InputTuple >::type fifth_type
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type > type
tuple_element< 4, InputTuple >::type fifth_type
indexer_node_base_operation(op_type t)
tuple_element< 6, InputTuple >::type seventh_type
tuple_element< 7, InputTuple >::type eighth_type
unfolded_indexer_node(graph &g)
indexer_types< OutputTuple >::input_ports_type input_ports_type
tuple_element< 1, InputTuple >::type second_type
void handle_operations(indexer_node_base_operation *op_list)
tuple_element< 1, InputTuple >::type second_type
tuple_element< 7, InputTuple >::type eighth_type
tuple_element< 0, InputTuple >::type first_type
internal::tagged_msg< size_t, first_type, second_type > type
indexer_node_base_operation(const output_type *e, op_type t)
tuple_element< 4, InputTuple >::type fifth_type
internal::indexer_node_base< input_ports_type, output_type, OutputTuple > indexer_base_type
tuple_element< 0, InputTuple >::type first_type
tuple_element< 5, InputTuple >::type sixth_type
internal::tagged_msg< size_t, first_type, second_type, third_type > 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 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
static void set_indexer_node_pointer(PortTuple &my_input, IndexerNodeBaseType *p, graph &g)
indexer_node_base_operation(const successor_type &s, op_type t)
tuple_element< 5, InputTuple >::type sixth_type
void const char const char int ITT_FORMAT __itt_group_sync s
tuple_element< 5, InputTuple >::type sixth_type
indexer_types< OutputTuple >::indexer_base_type base_type
indexer_node_base< InputTuple, output_type, StructTypes > class_type
tuple_element< 5, InputTuple >::type sixth_type
void reset_receiver(reset_flags) __TBB_override
tuple_element< 2, InputTuple >::type third_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 * task
indexer_node_base(graph &g)
tuple_element< 2, InputTuple >::type third_type
bool remove_successor(successor_type &r) __TBB_override
Removes a successor from this node.
uintptr_t status
Zero value means "wait" status, all other values are "user" specified values and are defined into the...
tuple_element< 9, InputTuple >::type tenth_type
tuple_element< 1, InputTuple >::type second_type
task * try_put_task(const T &v) __TBB_override
tuple_element< 3, InputTuple >::type fourth_type
tuple_element< 1, InputTuple >::type second_type
tuple_element< 4, InputTuple >::type fifth_type
tuple_element< 2, InputTuple >::type third_type
unfolded_indexer_node(const unfolded_indexer_node &other)
tuple_element< 0, InputTuple >::type first_type
tuple_element< 2, InputTuple >::type third_type
internal::aggregating_functor< class_type, indexer_node_base_operation > handler_type
static void reset_inputs(InputTuple &my_input, reset_flags f)
aggregated_operation base class
void set_up(void *p, forward_function_ptr f, graph &g)
tuple_element< 0, InputTuple >::type first_type
internal::indexer_node_FE< input_ports_type, output_type, OutputTuple > indexer_FE_type
tuple_element< 1, InputTuple >::type second_type
wrap_tuple_elements< N, indexer_input_port, OutputTuple >::type input_ports_type
task * do_try_put(const T &v, void *p)
tuple_element< 2, InputTuple >::type third_type
indexer_node_FE< InputTuple, output_type, StructTypes > input_ports_type
broadcast_cache< output_type, null_rw_mutex > my_successors
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type, seventh_type, eighth_type, nineth_type > type
tuple_element< 8, InputTuple >::type nineth_type
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type > type
tuple_element< 2, InputTuple >::type third_type
void const char const char int ITT_FORMAT __itt_group_sync p
void initialize_handler(handler_type h)
tuple_element< 0, InputTuple >::type first_type
internal::tagged_msg< size_t, first_type > type
tuple_element< 0, InputTuple >::type first_type
static void reset_inputs(InputTuple &my_input, reset_flags f)
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type, seventh_type, eighth_type, nineth_type, tenth_type > type
tuple_element< 0, InputTuple >::type first_type
tuple_element< 1, InputTuple >::type second_type
tuple_element< 3, InputTuple >::type fourth_type
A cache of successors that are put in a round-robin fashion.