Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Go to the documentation of this file.
17 #ifndef __TBB__flow_graph_node_impl_H
18 #define __TBB__flow_graph_node_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 T,
typename A >
60 template<
typename Input,
typename Policy,
typename A,
typename ImplType >
63 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
64 , add_blt_pred, del_blt_pred,
65 blt_pred_cnt, blt_pred_cpy
79 "queueing and rejecting policies can't be specified simultaneously");
81 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
82 typedef typename predecessor_cache_type::built_predecessors_type built_predecessors_type;
83 typedef typename receiver<input_type>::predecessor_list_type predecessor_list_type;
137 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
140 operation_type op_data(add_blt_pred);
147 operation_type op_data(del_blt_pred);
153 operation_type op_data(blt_pred_cnt);
155 return op_data.cnt_val;
159 operation_type op_data(blt_pred_cpy);
201 return op_data.bypass_t;
215 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
217 predecessor_list_type *predv;
232 task* new_task = NULL;
254 op_list = op_list->next;
269 tmp->bypass_t = NULL;
288 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
317 op->bypass_t = new_task;
345 return op_data.bypass_t;
374 return static_cast<ImplType *>(
this)->apply_body_impl_bypass(i);
380 new( task::allocate_additional_child_of(*(
my_graph_ref.root_task())) )
388 operation_type op_data(
try_fwd);
391 op_data.status =
WAIT;
394 task* ttask = op_data.bypass_t;
404 new( task::allocate_additional_child_of(*(
my_graph_ref.root_task())) )
420 template<
typename Input,
typename Output,
typename Policy,
typename A>
431 template<
typename Body>
452 template<
typename Body >
470 #if TBB_DEPRECATED_MESSAGE_FLOW_ORDER
473 task* postponed_task = NULL;
478 #if TBB_DEPRECATED_MESSAGE_FLOW_ORDER
482 if( postponed_task ) {
488 #if _MSC_VER && !__INTEL_COMPILER
489 #pragma warning (push)
490 #pragma warning (disable: 4127)
493 #if _MSC_VER && !__INTEL_COMPILER
494 #pragma warning (pop)
496 if(!successor_task) {
502 return successor_task;
527 (
void)tbb::flow::get<N-1>(
p).successors().clear();
531 if(tbb::flow::get<N-1>(
p).successors().empty())
539 (
void)tbb::flow::get<0>(
p).successors().clear();
542 return tbb::flow::get<0>(
p).successors().empty();
546 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
548 template<
int N>
struct extract_element {
549 template<
typename P>
static void extract_this(P &
p) {
550 (
void)tbb::flow::get<N-1>(
p).successors().built_successors().sender_extract(tbb::flow::get<N-1>(
p));
551 extract_element<N-1>::extract_this(
p);
555 template<>
struct extract_element<1> {
556 template<
typename P>
static void extract_this(P &
p) {
557 (
void)tbb::flow::get<0>(
p).successors().built_successors().sender_extract(tbb::flow::get<0>(
p));
562 template <
typename OutputTuple>
564 #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
565 template <
typename... Args>
566 static OutputTuple
call(graph& g,
const tbb::flow::tuple<Args...>&) {
567 return OutputTuple(Args(g)...);
569 #else // __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
570 template <
typename T1>
571 static OutputTuple
call(graph& g,
const tbb::flow::tuple<T1>&) {
572 return OutputTuple(T1(g));
575 template <
typename T1,
typename T2>
576 static OutputTuple
call(graph& g,
const tbb::flow::tuple<T1, T2>&) {
577 return OutputTuple(T1(g), T2(g));
580 template <
typename T1,
typename T2,
typename T3>
581 static OutputTuple
call(graph& g,
const tbb::flow::tuple<T1, T2, T3>&) {
582 return OutputTuple(T1(g), T2(g), T3(g));
585 template <
typename T1,
typename T2,
typename T3,
typename T4>
586 static OutputTuple
call(graph& g,
const tbb::flow::tuple<T1, T2, T3, T4>&) {
587 return OutputTuple(T1(g), T2(g), T3(g), T4(g));
590 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
591 static OutputTuple
call(graph& g,
const tbb::flow::tuple<T1, T2, T3, T4, T5>&) {
592 return OutputTuple(T1(g), T2(g), T3(g), T4(g), T5(g));
594 #if __TBB_VARIADIC_MAX >= 6
595 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
596 static OutputTuple
call(graph& g,
const tbb::flow::tuple<T1, T2, T3, T4, T5, T6>&) {
597 return OutputTuple(T1(g), T2(g), T3(g), T4(g), T5(g), T6(g));
600 #if __TBB_VARIADIC_MAX >= 7
601 template <
typename T1,
typename T2,
typename T3,
typename T4,
602 typename T5,
typename T6,
typename T7>
603 static OutputTuple
call(graph& g,
604 const tbb::flow::tuple<T1, T2, T3, T4, T5, T6, T7>&) {
605 return OutputTuple(T1(g), T2(g), T3(g), T4(g), T5(g), T6(g), T7(g));
608 #if __TBB_VARIADIC_MAX >= 8
609 template <
typename T1,
typename T2,
typename T3,
typename T4,
610 typename T5,
typename T6,
typename T7,
typename T8>
611 static OutputTuple
call(graph& g,
612 const tbb::flow::tuple<T1, T2, T3, T4, T5, T6, T7, T8>&) {
613 return OutputTuple(T1(g), T2(g), T3(g), T4(g), T5(g), T6(g), T7(g), T8(g));
616 #if __TBB_VARIADIC_MAX >= 9
617 template <
typename T1,
typename T2,
typename T3,
typename T4,
618 typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
619 static OutputTuple
call(graph& g,
620 const tbb::flow::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>&) {
621 return OutputTuple(T1(g), T2(g), T3(g), T4(g), T5(g), T6(g), T7(g), T8(g), T9(g));
624 #if __TBB_VARIADIC_MAX >= 9
625 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
626 typename T6,
typename T7,
typename T8,
typename T9,
typename T10>
627 static OutputTuple
call(graph& g,
628 const tbb::flow::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>&) {
629 return OutputTuple(T1(g), T2(g), T3(g), T4(g), T5(g), T6(g), T7(g), T8(g), T9(g), T10(g));
632 #endif // __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
637 template<
typename Input,
typename OutputPortSet,
typename Policy,
typename A>
649 template<
typename Body>
671 template<
typename Body >
694 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
718 template<
size_t N,
typename MOP>
720 return tbb::flow::get<N>(op.output_ports());
732 template<
typename T,
typename P>
735 task* last_task = tbb::flow::get<N-1>(
p).try_put_task(tbb::flow::get<N-1>(t));
743 template<
typename T,
typename P>
745 task* last_task = tbb::flow::get<0>(
p).try_put_task(tbb::flow::get<0>(t));
752 template<
typename Output,
typename Policy>
764 template<
typename Body >
772 template<
typename Body >
791 template<
typename Body >
798 continue_receiver::reset_receiver(f);
830 #if _MSC_VER && !__INTEL_COMPILER
831 #pragma warning (push)
832 #pragma warning (disable: 4127)
835 #if _MSC_VER && !__INTEL_COMPILER
836 #pragma warning (pop)
841 return new ( task::allocate_additional_child_of( *(
my_graph_ref.root_task()) ) )
853 template<
typename Output >
861 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
862 typedef typename sender<output_type>::built_successors_type built_successors_type;
863 typedef typename sender<output_type>::successor_list_type successor_list_type;
883 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
888 successors().internal_add_built_successor( r );
892 successors().internal_delete_built_successor( r );
924 template<
typename Output >
936 if(!res)
return false;
956 #if __TBB_FLOW_GRAPH_CPP11_FEATURES
957 template<
typename CompositeType>
960 template<
typename CompositeType,
typename NodeType1,
typename... NodeTypes >
961 void add_nodes_impl(CompositeType *c_node,
bool visible,
const NodeType1& n1,
const NodeTypes&... n) {
962 void *
addr = const_cast<NodeType1 *>(&n1);
971 #endif // __TBB__flow_graph_node_impl_H
void reset_function_input_base(reset_flags f)
task * apply_body_bypass(const input_type &i)
Applies the body to the provided input.
predecessor_cache< input_type, null_mutex > my_predecessors
virtual multifunction_body * clone()=0
receiver< input_type >::predecessor_type predecessor_type
function_body< input_type, output_type > function_body_type
task * try_put_task(const T &t) __TBB_override
multifunction_output(graph &g)
broadcast_cache< output_type > broadcast_cache_type
function_output(graph &g)
void check_task_and_spawn(graph &g, task *t)
multifunction_body_type * my_body
bool is_graph_active(tbb::flow::interface10::graph &g)
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
void set_owner(successor_type *owner)
task * try_put_task(const output_type &i)
task * perform_queued_requests()
static bool this_empty(P &p)
allocator_traits< Alloc >::template rebind_alloc< T >::other type
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
bool push_back(item_type &v)
function_output(const function_output &other)
virtual ~function_input_base()
Destructor.
Base class for types that should not be assigned.
virtual broadcast_cache< output_type > & successors()=0
bool pop_front(item_type &v)
input_queue_type * my_queue
continue_input(graph &g, int number_of_predecessors,)
internal::aggregating_functor< class_type, operation_type > handler_type
#define __TBB_FLOW_GRAPH_PRIORITY_EXPR(expr)
Output output_type
The output type of this receiver.
function_input_base< Input, Policy, A, ImplType > class_type
static task * emit_this(graph &g, const T &t, P &p)
leaf for multifunction. OutputSet can be a std::tuple or a vector.
#define __TBB_FLOW_GRAPH_PRIORITY_ARG1(arg1, priority)
bool get_item(output_type &v)
task * forward_task()
This is executed by an enqueued task, the "forwarder".
void reset_receiver(reset_flags f) __TBB_override
aggregated_operation base class
function_input(graph &g, size_t max_concurrency,)
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
function_body_type * my_body
function_input_base< Input, Policy, A, my_class > base_type
sender< output_type >::successor_type successor_type
continue_input(graph &g, __TBB_FLOW_GRAPH_PRIORITY_ARG1(Body &body, node_priority_t priority))
Base class for user-defined tasks.
graph & graph_reference() const __TBB_override
virtual function_body * clone()=0
bool remove_predecessor(predecessor_type &src) __TBB_override
Removes src from the list of cached predecessors.
__TBB_STATIC_ASSERT(!((internal::has_policy< queueing, Policy >::value) &&(internal::has_policy< rejecting, Policy >::value)), "queueing and rejecting policies can't be specified simultaneously")
const size_t my_max_concurrency
the leaf for function_body
predecessor_cache< input_type, null_mutex > predecessor_cache_type
void reset_function_input(reset_flags f)
continue_input< output_type, Policy > class_type
output_type apply_body_impl(const input_type &i)
continue_msg input_type
The input type of this receiver.
function_input(const function_input &src)
Copy constructor.
bool buffer_empty() const
static tbb::task *const SUCCESSFULLY_ENQUEUED
void remove_successor(successor_type &r)
A task that calls a node's apply_body_bypass function, passing in an input of type Input.
virtual broadcast_cache< output_type > & successors()=0
static void fgt_begin_body(void *)
static void clear_this(P &p)
Body copy_function_object()
static void clear_this(P &p)
broadcast_cache_type my_successors
multifunction_body_type * my_init_body
multifunction_output(const multifunction_output &other)
task * execute() __TBB_override
task * apply_body_impl_bypass(const input_type &i)
task * create_body_task(const input_type &input)
allocates a task to apply a body
operation_type(const input_type &e, op_type t)
void handle_operations(operation_type *op_list)
bool register_successor(successor_type &r) __TBB_override
Adds a new successor to this node.
task * try_put_task_impl(const input_type &t, tbb::internal::true_type)
multifunction_input< Input, OutputPortSet, Policy, A > my_class
static void fgt_alias_port(void *, void *, bool)
task * internal_try_put_bypass(const input_type &t)
void reset_receiver(reset_flags f) __TBB_override
task * create_forward_task()
static bool this_empty(P &p)
void spawn_forward_task()
Spawns a task that calls forward()
broadcast_cache_type & successors()
function_output< output_type > base_type
function_input_base< Input, Policy, A, my_class > base_type
function_body< input_type, output_type > function_body_type
void __TBB_store_with_release(volatile T &location, V value)
static task * emit_this(graph &g, const T &t, P &p)
function_input_queue< input_type, A > input_queue_type
aggregator< handler_type, operation_type > my_aggregator
void add_nodes_impl(CompositeType *, bool)
function_body_type * my_init_body
function_input< Input, Output, Policy, A > my_class
task * try_get_postponed_task(const input_type &i)
task * try_put_task(const input_type &t) __TBB_override
Put item to successor; return task to run the successor if possible.
Implements methods for a function node that takes a type Input as input and sends.
int max_concurrency()
Returns the maximal number of threads that can work inside the arena.
unsigned int node_priority_t
Implements methods for an executable node that takes continue_msg as input.
void reset(reset_flags f)
multifunction_body< input_type, output_ports_type > multifunction_body_type
continue_input(const continue_input &src)
bool try_put(const output_type &i)
Implements methods for a function node that takes a type Input as input.
tbb::internal::allocator_rebind< A, input_queue_type >::type queue_allocator_type
OutputPortSet output_ports_type
void internal_forward(operation_type *op)
Creates tasks for postponed messages if available and if concurrency allows.
function_input_queue< input_type, A > input_queue_type
untyped_sender predecessor_type
The predecessor type for this node.
task * apply_body_bypass(input_type)
Applies the body to the provided input.
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
function_input_base(const function_input_base &src)
Copy constructor.
operation_type(op_type t)
void register_successor(successor_type &r)
graph & graph_reference() const __TBB_override
function_body that takes an Input and a set of output ports
function_input_queue< input_type, A > input_queue_type
void internal_try_put_task(operation_type *op)
Put to the node, but return the task instead of enqueueing it.
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
Input and scheduling for a function node that takes a type Input as input.
A task that calls a node's forward_task function.
bool remove_successor(successor_type &r) __TBB_override
Removes a successor from this node.
static void fgt_end_body(void *)
function_input_base(graph &g, __TBB_FLOW_GRAPH_PRIORITY_ARG1(size_t max_concurrency, node_priority_t priority))
Constructor for function_input_base.
task * try_put_task(const output_type &i)
void const char const char int ITT_FORMAT __itt_group_sync p
graph & graph_reference() const
A functor that takes an Input and generates an Output.
multifunction_input(graph &g, size_t max_concurrency,)
void set_owner(owner_type *owner)
task * apply_body_impl_bypass(const input_type &i)
Implements methods for both executable and function nodes that puts Output to its successors.
tbb::flow::tuple_element< N, typename MOP::output_ports_type >::type & output_port(MOP &op)
Input input_type
The input type of this receiver.
Body copy_function_object()
function_body_type * my_body
const item_type & front() const
output_ports_type my_output_ports
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_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
multifunction_input(const multifunction_input &src)
Copy constructor.
void call(F &&f, Pack &&p)
Calls the given function with arguments taken from a stored_pack.
Body copy_function_object()
bool register_predecessor(predecessor_type &src) __TBB_override
Adds src to the list of cached predecessors.
function_body_type * my_init_body
output_ports_type & output_ports()
task * try_put_task_impl(const input_type &t, tbb::internal::false_type)
static OutputTuple call(graph &g, const tbb::flow::tuple< Args... > &)
Copyright © 2005-2020 Intel Corporation. All Rights Reserved.
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
registered trademarks or trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
* Other names and brands may be claimed as the property of others.