Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface11::async_node< Input, Output, Policy, Allocator > Class Template Reference

Implements async node. More...

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >:
Collaboration diagram for tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >:

Classes

class  receiver_gateway_impl
 
struct  try_put_functor
 

Public Types

typedef Input input_type
 
typedef Output output_type
 
typedef receiver< input_typereceiver_type
 
typedef receiver_type::predecessor_type predecessor_type
 
typedef sender< output_type >::successor_type successor_type
 
typedef receiver_gateway< output_typegateway_type
 
typedef internal::async_body_base< gateway_typeasync_body_base_type
 
typedef base_type::output_ports_type output_ports_type
 
- Public Types inherited from tbb::flow::interface11::multifunction_node< Input, tuple< Output >, Policy, Allocator >
typedef Input input_type
 
typedef null_type output_type
 
typedef internal::wrap_tuple_elements< N, internal::multifunction_output, tuple< Output > >::type output_ports_type
 
typedef internal::multifunction_input< input_type, output_ports_type, Policy, Allocator > input_impl_type
 
typedef internal::function_input_queue< input_type, Allocator > input_queue_type
 
- Public Types inherited from internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator >
typedef Input input_type
 
typedef internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type output_ports_type
 
typedef multifunction_body< input_type, output_ports_typemultifunction_body_type
 
typedef multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator > my_class
 
typedef function_input_base< Input, Policy, Allocator, my_classbase_type
 
typedef function_input_queue< input_type, Allocator > input_queue_type
 
- Public Types inherited from internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator > >
typedef Input input_type
 The input type of this receiver. More...
 
typedef receiver< input_type >::predecessor_type predecessor_type
 
typedef predecessor_cache< input_type, null_mutex > predecessor_cache_type
 
typedef function_input_queue< input_type, Allocator > input_queue_type
 
typedef Allocator ::template rebind< input_queue_type >::other queue_allocator_type
 
- Public Types inherited from tbb::flow::interface11::internal::untyped_receiver
typedef untyped_sender predecessor_type
 The predecessor type for this node. More...
 
- Public Types inherited from tbb::flow::interface11::internal::untyped_sender
typedef untyped_receiver successor_type
 The successor type for this node. More...
 

Public Member Functions

template<typename Body >
__TBB_NOINLINE_SYM async_node (graph &g, size_t concurrency,)
 
__TBB_NOINLINE_SYM async_node (const async_node &other)
 
gateway_typegateway ()
 
bool register_successor (successor_type &r) __TBB_override
 Add a new successor to this node. More...
 
bool remove_successor (successor_type &r) __TBB_override
 Removes a successor from this node. More...
 
template<typename Body >
Body copy_function_object ()
 
- Public Member Functions inherited from tbb::flow::interface11::multifunction_node< Input, tuple< Output >, Policy, Allocator >
__TBB_NOINLINE_SYM multifunction_node (graph &g, size_t concurrency,)
 
__TBB_NOINLINE_SYM multifunction_node (const multifunction_node &other)
 
- Public Member Functions inherited from tbb::flow::interface11::graph_node
 graph_node (graph &g)
 
virtual ~graph_node ()
 
- Public Member Functions inherited from internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator >
 multifunction_input (graph &g, size_t max_concurrency,)
 
 multifunction_input (const multifunction_input &src)
 Copy constructor. More...
 
 ~multifunction_input ()
 
Body copy_function_object ()
 
taskapply_body_impl_bypass (const input_type &i)
 
output_ports_typeoutput_ports ()
 
- Public Member Functions inherited from internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator > >
 __TBB_STATIC_ASSERT (!((internal::has_policy< queueing, Policy >::value) &&(internal::has_policy< rejecting, Policy >::value)), "queueing and rejecting policies can't be specified simultaneously")
 
 function_input_base (graph &g, __TBB_FLOW_GRAPH_PRIORITY_ARG1(size_t max_concurrency, node_priority_t priority))
 Constructor for function_input_base. More...
 
 function_input_base (const function_input_base &src)
 Copy constructor. More...
 
virtual ~function_input_base ()
 Destructor. More...
 
tasktry_put_task (const input_type &t) __TBB_override
 Put item to successor; return task to run the successor if possible. More...
 
bool register_predecessor (predecessor_type &src) __TBB_override
 Adds src to the list of cached predecessors. More...
 
bool remove_predecessor (predecessor_type &src) __TBB_override
 Removes src from the list of cached predecessors. More...
 
- Public Member Functions inherited from tbb::flow::interface11::receiver< Input >
bool try_put (const typename internal::async_helpers< Input >::filtered_type &t)
 Put an item to the receiver. More...
 
bool try_put (const typename internal::async_helpers< Input >::async_type &t)
 
- Public Member Functions inherited from tbb::flow::interface11::internal::untyped_receiver
virtual ~untyped_receiver ()
 Destructor. More...
 
template<typename X >
bool try_put (const X &t)
 Put an item to the receiver. More...
 
- Public Member Functions inherited from tbb::flow::interface11::sender< Output >
virtual bool try_get (Output &)
 Request an item from the sender. More...
 
virtual bool try_reserve (Output &)
 Reserves an item in the sender. More...
 
- Public Member Functions inherited from tbb::flow::interface11::internal::untyped_sender
virtual ~untyped_sender ()
 
virtual bool try_release ()
 Releases the reserved item. More...
 
virtual bool try_consume ()
 Consumes the reserved item. More...
 

Protected Member Functions

void reset_node (reset_flags f) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface11::multifunction_node< Input, tuple< Output >, Policy, Allocator >
void reset_node (reset_flags f) __TBB_override
 
- Protected Member Functions inherited from internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator >
void reset (reset_flags f)
 
- Protected Member Functions inherited from internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator > >
void reset_function_input_base (reset_flags f)
 
void reset_receiver (reset_flags f) __TBB_override
 
graph & graph_reference () const __TBB_override
 
tasktry_get_postponed_task (const input_type &i)
 
- Protected Member Functions inherited from tbb::flow::interface11::receiver< Input >
virtual tasktry_put_task_wrapper (const void *p, bool is_async) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface11::internal::untyped_receiver
template<typename X >
tasktry_put_task (const X &t)
 
virtual void reset_receiver (reset_flags f=rf_reset_protocol)=0
 put receiver back in initial state More...
 
virtual bool is_continue_receiver ()
 
- Protected Member Functions inherited from tbb::flow::interface11::sender< Output >
virtual bool try_get_wrapper (void *p, bool is_async) __TBB_override
 
virtual bool try_reserve_wrapper (void *p, bool is_async) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface11::internal::untyped_sender
template<typename X >
bool try_get (X &t)
 Request an item from the sender. More...
 
template<typename X >
bool try_reserve (X &t)
 Reserves an item in the sender. More...
 

Private Types

typedef multifunction_node< Input, tuple< Output >, Policy, Allocator > base_type
 
typedef internal::multifunction_input< Input, typename base_type::output_ports_type, Policy, Allocator > mfn_input_type
 

Private Member Functions

async_nodeself ()
 
bool try_put_impl (const Output &i)
 Implements gateway_type::try_put for an external activity to submit a message to FG. More...
 

Private Attributes

tbb::flow::interface11::async_node::receiver_gateway_impl my_gateway
 

Additional Inherited Members

- Public Attributes inherited from tbb::flow::interface11::receiver< Input >
__TBB_DEPRECATED typedef Input input_type
 The input type of this receiver. More...
 
__TBB_DEPRECATED typedef internal::async_helpers< Input >::filtered_type filtered_type
 
- Public Attributes inherited from tbb::flow::interface11::sender< Output >
__TBB_DEPRECATED typedef Output output_type
 The output type of this sender. More...
 
__TBB_DEPRECATED typedef internal::async_helpers< Output >::filtered_type filtered_type
 
- Static Public Attributes inherited from internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator >
static const int N
 
- Protected Attributes inherited from tbb::flow::interface11::graph_node
graphmy_graph
 
graph_nodenext
 
graph_nodeprev
 
- Protected Attributes inherited from internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator >
multifunction_body_typemy_body
 
multifunction_body_typemy_init_body
 
output_ports_type my_output_ports
 
- Protected Attributes inherited from internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator > >
graph & my_graph_ref
 
const size_t my_max_concurrency
 
size_t my_concurrency
 
input_queue_typemy_queue
 
predecessor_cache< input_type, null_mutex > my_predecessors
 
- Static Protected Attributes inherited from tbb::flow::interface11::multifunction_node< Input, tuple< Output >, Policy, Allocator >
static const int N
 

Detailed Description

template<typename Input, typename Output, typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
class tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >

Implements async node.

Definition at line 3826 of file flow_graph.h.

Member Typedef Documentation

◆ async_body_base_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef internal::async_body_base<gateway_type> tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::async_body_base_type

Definition at line 3837 of file flow_graph.h.

◆ base_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef multifunction_node< Input, tuple< Output >, Policy, Allocator > tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::base_type
private

Definition at line 3827 of file flow_graph.h.

◆ gateway_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef receiver_gateway<output_type> tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::gateway_type

Definition at line 3836 of file flow_graph.h.

◆ input_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef Input tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::input_type

Definition at line 3831 of file flow_graph.h.

◆ mfn_input_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef internal::multifunction_input<Input, typename base_type::output_ports_type, Policy, Allocator> tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::mfn_input_type
private

Definition at line 3828 of file flow_graph.h.

◆ output_ports_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef base_type::output_ports_type tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::output_ports_type

Definition at line 3838 of file flow_graph.h.

◆ output_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef Output tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::output_type

Definition at line 3832 of file flow_graph.h.

◆ predecessor_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef receiver_type::predecessor_type tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::predecessor_type

Definition at line 3834 of file flow_graph.h.

◆ receiver_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef receiver<input_type> tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::receiver_type

Definition at line 3833 of file flow_graph.h.

◆ successor_type

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
typedef sender<output_type>::successor_type tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::successor_type

Definition at line 3835 of file flow_graph.h.

Constructor & Destructor Documentation

◆ async_node() [1/2]

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
template<typename Body >
__TBB_NOINLINE_SYM tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::async_node ( graph g,
size_t  concurrency 
)
inline

Definition at line 3897 of file flow_graph.h.

3904  : base_type(
3905  g, concurrency,
3906  internal::async_body<Input, typename base_type::output_ports_type, gateway_type, Body>
3907  (body, &my_gateway) __TBB_FLOW_GRAPH_PRIORITY_ARG0(priority) ), my_gateway(self()) {
3908  tbb::internal::fgt_multioutput_node_with_body<1>(
3909  CODEPTR(), tbb::internal::FLOW_ASYNC_NODE,
3910  &this->my_graph, static_cast<receiver<input_type> *>(this),
3911  this->output_ports(), this->my_body
3912  );
3913  }

References CODEPTR.

◆ async_node() [2/2]

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
__TBB_NOINLINE_SYM tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::async_node ( const async_node< Input, Output, Policy, Allocator > &  other)
inline

Definition at line 3937 of file flow_graph.h.

3937  : base_type(other), sender<Output>(), my_gateway(self()) {
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);
3940 
3941  tbb::internal::fgt_multioutput_node_with_body<1>( CODEPTR(), tbb::internal::FLOW_ASYNC_NODE,
3942  &this->my_graph, static_cast<receiver<input_type> *>(this),
3943  this->output_ports(), this->my_body );
3944  }

References CODEPTR.

Member Function Documentation

◆ copy_function_object()

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
template<typename Body >
Body tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::copy_function_object ( )
inline

Definition at line 3969 of file flow_graph.h.

3969  {
3971  typedef internal::async_body<Input, typename base_type::output_ports_type, gateway_type, Body> async_body_type;
3972  mfn_body_type &body_ref = *this->my_body;
3973  async_body_type ab = *static_cast<async_body_type*>(dynamic_cast< internal::multifunction_body_leaf<input_type, typename base_type::output_ports_type, async_body_type> & >(body_ref).get_body_ptr());
3974  return ab.get_body();
3975  }

◆ gateway()

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
gateway_type& tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::gateway ( )
inline

Definition at line 3946 of file flow_graph.h.

3946  {
3947  return my_gateway;
3948  }

◆ register_successor()

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
bool tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::register_successor ( successor_type r)
inlinevirtual

Add a new successor to this node.

Implements tbb::flow::interface11::internal::untyped_sender.

Definition at line 3959 of file flow_graph.h.

3959  {
3960  return internal::output_port<0>(*this).register_successor(r);
3961  }

◆ remove_successor()

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
bool tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::remove_successor ( successor_type r)
inlinevirtual

Removes a successor from this node.

Implements tbb::flow::interface11::internal::untyped_sender.

Definition at line 3964 of file flow_graph.h.

3964  {
3965  return internal::output_port<0>(*this).remove_successor(r);
3966  }

◆ reset_node()

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
void tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::reset_node ( reset_flags  f)
inlineprotectedvirtual

Implements tbb::flow::interface11::graph_node.

Definition at line 4004 of file flow_graph.h.

4004  {
4006  }

◆ self()

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
async_node* tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::self ( )
inlineprivate

Definition at line 3876 of file flow_graph.h.

3876 { return this; }

◆ try_put_impl()

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
bool tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::try_put_impl ( const Output &  i)
inlineprivate

Implements gateway_type::try_put for an external activity to submit a message to FG.

Definition at line 3879 of file flow_graph.h.

3879  {
3880  internal::multifunction_output<Output> &port_0 = internal::output_port<0>(*this);
3881  internal::broadcast_cache<output_type>& port_successors = port_0.successors();
3883  task_list tasks;
3884  bool is_at_least_one_put_successful = port_successors.gather_successful_try_puts(i, tasks);
3885  __TBB_ASSERT( is_at_least_one_put_successful || tasks.empty(),
3886  "Return status is inconsistent with the method operation." );
3887 
3888  while( !tasks.empty() ) {
3889  internal::enqueue_in_graph_arena(this->my_graph, tasks.pop_front());
3890  }
3891  tbb::internal::fgt_async_try_put_end(this, &port_0);
3892  return is_at_least_one_put_successful;
3893  }

References __TBB_ASSERT, tbb::task_list::empty(), tbb::flow::interface11::internal::enqueue_in_graph_arena(), tbb::internal::fgt_async_try_put_begin(), tbb::internal::fgt_async_try_put_end(), tbb::task_list::pop_front(), and internal::function_output< Output >::successors().

Here is the call graph for this function:

Member Data Documentation

◆ my_gateway

template<typename Input , typename Output , typename Policy = queueing_lightweight, typename Allocator = cache_aligned_allocator<Input>>
tbb::flow::interface11::async_node::receiver_gateway_impl tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::my_gateway
private

The documentation for this class was generated from the following file:
tbb::internal::fgt_async_try_put_end
static void fgt_async_try_put_end(void *, void *)
Definition: _flow_graph_trace_impl.h:340
CODEPTR
#define CODEPTR()
Definition: _flow_graph_trace_impl.h:297
tbb::flow::interface11::async_node::base_type
multifunction_node< Input, tuple< Output >, Policy, Allocator > base_type
Definition: flow_graph.h:3827
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
internal::multifunction_output
Definition: _flow_graph_node_impl.h:925
internal::broadcast_cache< output_type >
internal::multifunction_body
function_body that takes an Input and a set of output ports
Definition: _flow_graph_body_impl.h:192
__TBB_FLOW_GRAPH_PRIORITY_ARG0
#define __TBB_FLOW_GRAPH_PRIORITY_ARG0(priority)
Definition: _flow_graph_impl.h:39
internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator >::output_ports
output_ports_type & output_ports()
Definition: _flow_graph_node_impl.h:691
tbb::flow::interface11::graph_node::my_graph
graph & my_graph
Definition: _flow_graph_impl.h:464
internal::broadcast_cache::gather_successful_try_puts
bool gather_successful_try_puts(const T &t, task_list &tasks)
Definition: _flow_graph_cache_impl.h:512
tbb::flow::interface11::async_node::my_gateway
tbb::flow::interface11::async_node::receiver_gateway_impl my_gateway
tbb::flow::interface11::multifunction_node< Input, tuple< Output >, Policy, Allocator >::reset_node
void reset_node(reset_flags f) __TBB_override
Definition: flow_graph.h:1343
tbb::flow::concurrency
concurrency
An enumeration the provides the two most common concurrency levels: unlimited and serial.
Definition: flow_graph.h:98
internal::function_output::successors
broadcast_cache_type & successors()
Definition: _flow_graph_node_impl.h:916
internal::multifunction_body::get_body_ptr
virtual void * get_body_ptr()=0
internal::multifunction_body_leaf
leaf for multifunction. OutputSet can be a std::tuple or a vector.
Definition: _flow_graph_body_impl.h:202
internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator >::my_body
multifunction_body_type * my_body
Definition: _flow_graph_node_impl.h:711
internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, Policy, Allocator >::my_init_body
multifunction_body_type * my_init_body
Definition: _flow_graph_node_impl.h:712
tbb::internal::fgt_async_try_put_begin
static void fgt_async_try_put_begin(void *, void *)
Definition: _flow_graph_trace_impl.h:339
tbb::flow::interface11::internal::enqueue_in_graph_arena
void enqueue_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Enqueues a task inside graph arena.
Definition: _flow_graph_impl.h:530

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.