21 #ifndef __TBB__flow_graph_indexer_impl_H 22 #define __TBB__flow_graph_indexer_impl_H 24 #ifndef __TBB_flow_graph_H 25 #error Do not #include this internal file directly; use public TBB headers instead. 37 template<
typename IndexerNodeBaseType,
typename T,
size_t K>
39 typename IndexerNodeBaseType::output_type o(K, v);
40 return reinterpret_cast<IndexerNodeBaseType *
>(
p)->try_put_task(&o);
43 template<
typename TupleTypes,
int N>
45 template<
typename IndexerNodeBaseType,
typename PortTuple>
47 typedef typename tuple_element<N-1, TupleTypes>
::type T;
48 task *(*indexer_node_put_task)(
const T&,
void *) = do_try_put<IndexerNodeBaseType, T, N-1>;
49 tbb::flow::get<N-1>(my_input).set_up(p, indexer_node_put_task, g);
50 indexer_helper<TupleTypes,N-1>::template set_indexer_node_pointer<IndexerNodeBaseType,PortTuple>(my_input,
p, g);
52 template<
typename InputTuple>
55 tbb::flow::get<N-1>(my_input).reset_receiver(f);
57 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 58 template<
typename InputTuple>
59 static inline void extract(InputTuple &my_input) {
61 tbb::flow::get<N-1>(my_input).extract_receiver();
66 template<
typename TupleTypes>
68 template<
typename IndexerNodeBaseType,
typename PortTuple>
71 task *(*indexer_node_put_task)(
const T&,
void *) = do_try_put<IndexerNodeBaseType, T, 0>;
72 tbb::flow::get<0>(my_input).set_up(p, indexer_node_put_task, g);
74 template<
typename InputTuple>
76 tbb::flow::get<0>(my_input).reset_receiver(f);
78 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 79 template<
typename InputTuple>
80 static inline void extract(InputTuple &my_input) {
81 tbb::flow::get<0>(my_input).extract_receiver();
90 typedef task* (* forward_function_ptr)(T
const &,
void* );
92 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 93 spin_mutex my_pred_mutex;
94 typedef typename receiver<T>::built_predecessors_type built_predecessors_type;
95 built_predecessors_type my_built_predecessors;
99 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 104 void set_up(
void*
p, forward_function_ptr f, graph& g) {
109 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 110 typedef typename receiver<T>::predecessor_list_type predecessor_list_type;
111 typedef typename receiver<T>::predecessor_type predecessor_type;
113 built_predecessors_type &built_predecessors()
__TBB_override {
return my_built_predecessors; }
116 spin_mutex::scoped_lock l(my_pred_mutex);
117 return my_built_predecessors.edge_count();
119 void internal_add_built_predecessor(predecessor_type &
p)
__TBB_override {
120 spin_mutex::scoped_lock l(my_pred_mutex);
121 my_built_predecessors.add_edge(p);
123 void internal_delete_built_predecessor(predecessor_type &p)
__TBB_override {
124 spin_mutex::scoped_lock l(my_pred_mutex);
125 my_built_predecessors.delete_edge(p);
127 void copy_predecessors( predecessor_list_type &v)
__TBB_override {
128 spin_mutex::scoped_lock l(my_pred_mutex);
129 my_built_predecessors.copy_edges(v);
133 template<
typename R,
typename B >
friend class run_and_put_task;
137 return my_try_put_task(v, my_indexer_ptr);
145 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 151 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 152 void extract_receiver() { my_built_predecessors.receiver_extract(*
this); }
156 template<
typename InputTuple,
typename OutputType,
typename StructTypes>
172 template<
typename InputTuple,
typename OutputType,
typename StructTypes>
174 public sender<OutputType> {
176 using graph_node::my_graph;
183 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 184 typedef typename sender<output_type>::built_successors_type built_successors_type;
185 typedef typename sender<output_type>::successor_list_type successor_list_type;
190 enum op_type { reg_succ, rem_succ, try__put_task
191 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 192 , add_blt_succ, del_blt_succ,
193 blt_succ_cnt, blt_succ_cpy
205 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 207 successor_list_type *succv;
211 type(char(t)), my_arg(e) {}
213 my_succ(const_cast<successor_type *>(&s)) {}
217 typedef internal::aggregating_functor<class_type, indexer_node_base_operation>
handler_type;
225 op_list = op_list->next;
226 switch(current->
type) {
229 my_successors.register_successor(*(current->
my_succ));
234 my_successors.remove_successor(*(current->
my_succ));
237 case try__put_task: {
238 current->
bypass_t = my_successors.try_put_task(*(current->
my_arg));
242 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 244 my_successors.internal_add_built_successor(*(current->
my_succ));
248 my_successors.internal_delete_built_successor(*(current->
my_succ));
252 current->cnt_val = my_successors.successor_count();
256 my_successors.copy_successors(*(current->succv));
267 my_successors.set_owner(
this);
268 my_aggregator.initialize_handler(handler_type(
this));
273 my_successors.set_owner(
this);
274 my_aggregator.initialize_handler(handler_type(
this));
279 my_aggregator.execute(&op_data);
285 my_aggregator.execute(&op_data);
291 my_aggregator.execute(&op_data);
295 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 297 built_successors_type &built_successors()
__TBB_override {
return my_successors.built_successors(); }
299 void internal_add_built_successor( successor_type &r)
__TBB_override {
301 my_aggregator.execute(&op_data);
304 void internal_delete_built_successor( successor_type &r)
__TBB_override {
306 my_aggregator.execute(&op_data);
311 my_aggregator.execute(&op_data);
312 return op_data.cnt_val;
318 my_aggregator.execute(&op_data);
321 my_successors.built_successors().sender_extract(*
this);
328 my_successors.clear();
340 template<
typename InputTuple>
346 template<
typename InputTuple>
353 template<
typename InputTuple>
361 template<
typename InputTuple>
371 template<
typename InputTuple>
382 template<
typename InputTuple>
391 fourth_type, fifth_type, sixth_type>
type;
394 template<
typename InputTuple>
404 fourth_type, fifth_type, sixth_type,
409 template<
typename InputTuple>
420 fourth_type, fifth_type, sixth_type,
421 seventh_type, eighth_type>
type;
425 template<
typename InputTuple>
437 fourth_type, fifth_type, sixth_type,
438 seventh_type, eighth_type, nineth_type>
type;
441 template<
typename InputTuple>
454 fourth_type, fifth_type, sixth_type,
455 seventh_type, eighth_type, nineth_type,
460 template<
typename OutputTuple>
469 template<
class OutputTuple>
tuple_element< 0, InputTuple >::type first_type
void reset_receiver(reset_flags) __TBB_override
indexer_node_FE< InputTuple, output_type, StructTypes > input_ports_type
tuple_element< 6, InputTuple >::type seventh_type
tuple_element< 2, InputTuple >::type third_type
indexer_node_base(const indexer_node_base &other)
tuple_element< 3, InputTuple >::type fourth_type
internal::aggregating_functor< class_type, indexer_node_base_operation > handler_type
static void reset_inputs(InputTuple &my_input, reset_flags f)
tuple_element< 7, InputTuple >::type eighth_type
internal::tagged_msg< size_t, first_type > type
A cache of successors that are put in a round-robin fashion.
unfolded_indexer_node(const unfolded_indexer_node &other)
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type, seventh_type, eighth_type > type
indexer_node_base_operation(op_type t)
tuple_element< 6, InputTuple >::type seventh_type
tuple_element< 3, InputTuple >::type fourth_type
tuple_element< 0, InputTuple >::type first_type
tuple_element< 4, InputTuple >::type fifth_type
output_type const * my_arg
tuple_element< 2, InputTuple >::type third_type
tuple_element< 6, InputTuple >::type seventh_type
unfolded_indexer_node(graph &g)
tuple_element< 2, InputTuple >::type third_type
tuple_element< 1, InputTuple >::type second_type
aggregator< handler_type, indexer_node_base_operation > my_aggregator
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
task * try_put_task(output_type const *v)
tuple_element< 2, InputTuple >::type third_type
tuple_element< 6, InputTuple >::type seventh_type
tuple_element< 1, InputTuple >::type second_type
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type, seventh_type > type
indexer_types< OutputTuple >::indexer_base_type base_type
tuple_element< 8, InputTuple >::type nineth_type
indexer_node_base< InputTuple, output_type, StructTypes > class_type
indexer_node_base(graph &g)
static void reset_inputs(InputTuple &my_input, reset_flags f)
tuple_element< 5, InputTuple >::type sixth_type
internal::indexer_node_FE< input_ports_type, output_type, OutputTuple > indexer_FE_type
tuple_element< 3, InputTuple >::type fourth_type
tuple_element< 4, InputTuple >::type fifth_type
void const char const char int ITT_FORMAT __itt_group_sync p
internal::indexer_node_base< input_ports_type, output_type, OutputTuple > indexer_base_type
bool remove_successor(successor_type &r) __TBB_override
Removes a successor from this node.
tuple_element< 7, InputTuple >::type eighth_type
void set_up(void *p, forward_function_ptr f, graph &g)
tuple_element< 1, InputTuple >::type second_type
tuple_element< 5, InputTuple >::type sixth_type
tuple_element< 2, InputTuple >::type third_type
task * do_try_put(const T &v, void *p)
tuple_element< 5, InputTuple >::type sixth_type
void handle_operations(indexer_node_base_operation *op_list)
tuple_element< 4, InputTuple >::type fifth_type
tuple_element< 3, InputTuple >::type fourth_type
tuple_element< 0, InputTuple >::type first_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
graph & graph_reference() __TBB_override
tuple_element< 0, InputTuple >::type first_type
indexer_node_base_operation(const successor_type &s, op_type t)
broadcast_cache< output_type, null_rw_mutex > my_successors
sender< output_type >::successor_type successor_type
indexer_types< OutputTuple >::input_ports_type input_ports_type
tuple_element< 7, InputTuple >::type eighth_type
static void set_indexer_node_pointer(PortTuple &my_input, IndexerNodeBaseType *p, graph &g)
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type > type
tuple_element< 1, InputTuple >::type second_type
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
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
tuple_element< 0, InputTuple >::type first_type
indexer_node_base_operation(const output_type *e, op_type t)
tuple_element< 4, InputTuple >::type fifth_type
tuple_element< 0, InputTuple >::type first_type
tuple_element< 5, InputTuple >::type sixth_type
tuple_element< 2, InputTuple >::type third_type
tuple_element< 9, InputTuple >::type tenth_type
internal::tagged_msg< size_t, first_type, second_type > type
input_type & input_ports()
A cache of successors that are broadcast to.
tuple_element< 5, InputTuple >::type sixth_type
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type, seventh_type, eighth_type, nineth_type > type
bool register_successor(successor_type &r) __TBB_override
Add a new successor to this node.
tuple_element< 0, InputTuple >::type first_type
void const char const char int ITT_FORMAT __itt_group_sync s
static void set_indexer_node_pointer(PortTuple &my_input, IndexerNodeBaseType *p, graph &g)
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type > type
indexer_types< OutputTuple >::output_type output_type
tuple_element< 4, InputTuple >::type fifth_type
tuple_element< 2, InputTuple >::type third_type
tuple_element< 3, InputTuple >::type fourth_type
tuple_element< 0, InputTuple >::type first_type
tuple_element< 2, InputTuple >::type third_type
tuple_element< 8, InputTuple >::type nineth_type
tuple_element< 4, InputTuple >::type fifth_type
tuple_element< 1, InputTuple >::type second_type
forward_function_ptr my_try_put_task
internal::tagged_msg< size_t, first_type, second_type, third_type, fourth_type, fifth_type, sixth_type > type
tuple_element< 1, InputTuple >::type second_type
tuple_element< 1, InputTuple >::type second_type
tuple_element< 1, InputTuple >::type second_type
task * try_put_task(const T &v) __TBB_override
tuple_element< 0, InputTuple >::type first_type
tuple_element< 0, InputTuple >::type first_type
wrap_tuple_elements< N, indexer_input_port, OutputTuple >::type input_ports_type
tuple_element< 3, InputTuple >::type fourth_type
internal::tagged_msg< size_t, first_type, second_type, third_type > type
tuple_element< 1, InputTuple >::type second_type
input_types< N, OutputTuple >::type output_type
void __TBB_store_with_release(volatile T &location, V value)
tuple_element< 3, InputTuple >::type fourth_type
void reset_node(reset_flags f) __TBB_override