Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface11::sequencer_node< T, A > Class Template Reference

Forwards messages in sequence order. More...

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface11::sequencer_node< T, A >:
Collaboration diagram for tbb::flow::interface11::sequencer_node< T, A >:

Public Types

typedef T input_type
 
typedef T output_type
 
typedef receiver< input_type >::predecessor_type predecessor_type
 
typedef sender< output_type >::successor_type successor_type
 
- Public Types inherited from tbb::flow::interface11::queue_node< T, A >
typedef T input_type
 
typedef T output_type
 
typedef receiver< input_type >::predecessor_type predecessor_type
 
typedef sender< output_type >::successor_type successor_type
 
- Public Types inherited from tbb::flow::interface11::buffer_node< T, A >
typedef T input_type
 
typedef T output_type
 
typedef receiver< input_type >::predecessor_type predecessor_type
 
typedef sender< output_type >::successor_type successor_type
 
typedef buffer_node< T, A > class_type
 
- Public Types inherited from internal::item_buffer< T, A >
enum  buffer_item_state { no_item =0, has_item =1, reserved_item =2 }
 
typedef T item_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 Sequencer >
__TBB_NOINLINE_SYM sequencer_node (graph &g, const Sequencer &s)
 Constructor. More...
 
__TBB_NOINLINE_SYM sequencer_node (const sequencer_node &src)
 Copy constructor. More...
 
 ~sequencer_node ()
 Destructor. More...
 
- Public Member Functions inherited from tbb::flow::interface11::queue_node< T, A >
__TBB_NOINLINE_SYM queue_node (graph &g)
 Constructor. More...
 
__TBB_NOINLINE_SYM queue_node (const queue_node &src)
 Copy constructor. More...
 
- Public Member Functions inherited from tbb::flow::interface11::buffer_node< T, A >
__TBB_NOINLINE_SYM buffer_node (graph &g)
 Constructor. More...
 
__TBB_NOINLINE_SYM buffer_node (const buffer_node &src)
 Copy constructor. More...
 
bool register_successor (successor_type &r) __TBB_override
 Adds a new successor. More...
 
bool remove_successor (successor_type &r) __TBB_override
 Removes a successor. More...
 
bool try_get (T &v) __TBB_override
 Request an item from the buffer_node. More...
 
bool try_reserve (T &v) __TBB_override
 Reserves an item. More...
 
bool try_release () __TBB_override
 Release a reserved item. More...
 
bool try_consume () __TBB_override
 Consumes a reserved item. More...
 
- Public Member Functions inherited from tbb::flow::interface11::graph_node
 graph_node (graph &g)
 
virtual ~graph_node ()
 
- Public Member Functions inherited from internal::reservable_item_buffer< T, A >
 reservable_item_buffer ()
 
void reset ()
 
- Public Member Functions inherited from internal::item_buffer< T, A >
 item_buffer ()
 Constructor. More...
 
 ~item_buffer ()
 
void reset ()
 
- Public Member Functions inherited from tbb::flow::interface11::receiver< T >
bool try_put (const typename internal::async_helpers< T >::filtered_type &t)
 Put an item to the receiver. More...
 
bool try_put (const typename internal::async_helpers< T >::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...
 
virtual bool register_predecessor (predecessor_type &)
 Add a predecessor to the node. More...
 
virtual bool remove_predecessor (predecessor_type &)
 Remove a predecessor from the node. More...
 
- Public Member Functions inherited from tbb::flow::interface11::internal::untyped_sender
virtual ~untyped_sender ()
 

Protected Types

typedef buffer_node< T, A >::size_type size_type
 
typedef buffer_node< T, A >::buffer_operation sequencer_operation
 
- Protected Types inherited from tbb::flow::interface11::queue_node< T, A >
typedef buffer_node< T, A > base_type
 
typedef base_type::size_type size_type
 
typedef base_type::buffer_operation queue_operation
 
typedef queue_node class_type
 
- Protected Types inherited from tbb::flow::interface11::buffer_node< T, A >
enum  op_type {
  reg_succ, rem_succ, req_item, res_item,
  rel_res, con_res, put_item, try_fwd_task
}
 
typedef size_t size_type
 
typedef internal::aggregating_functor< class_type, buffer_operationhandler_type
 
- Protected Types inherited from internal::item_buffer< T, A >
typedef size_t size_type
 
typedef aligned_pair< item_type, buffer_item_state >::type buffer_item_type
 
typedef A::template rebind< buffer_item_type >::other allocator_type
 

Private Member Functions

bool internal_push (sequencer_operation *op) __TBB_override
 

Private Attributes

internal::function_body< T, size_t > * my_sequencer
 

Additional Inherited Members

- Public Attributes inherited from tbb::flow::interface11::receiver< T >
__TBB_DEPRECATED typedef T input_type
 The input type of this receiver. More...
 
__TBB_DEPRECATED typedef internal::async_helpers< T >::filtered_type filtered_type
 
- Public Attributes inherited from tbb::flow::interface11::sender< T >
__TBB_DEPRECATED typedef T output_type
 The output type of this sender. More...
 
__TBB_DEPRECATED typedef internal::async_helpers< T >::filtered_type filtered_type
 
- Protected Member Functions inherited from tbb::flow::interface11::queue_node< T, A >
void internal_forward_task (queue_operation *op) __TBB_override
 Tries to forward valid items to successors. More...
 
void internal_pop (queue_operation *op) __TBB_override
 
void internal_reserve (queue_operation *op) __TBB_override
 
void internal_consume (queue_operation *op) __TBB_override
 
void reset_node (reset_flags f) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface11::buffer_node< T, A >
virtual void handle_operations (buffer_operation *op_list)
 
template<typename derived_type >
void handle_operations_impl (buffer_operation *op_list, derived_type *derived)
 
taskgrab_forwarding_task (buffer_operation &op_data)
 
bool enqueue_forwarding_task (buffer_operation &op_data)
 
virtual taskforward_task ()
 This is executed by an enqueued task, the "forwarder". More...
 
virtual void internal_reg_succ (buffer_operation *op)
 Register successor. More...
 
virtual void internal_rem_succ (buffer_operation *op)
 Remove successor. More...
 
template<typename derived_type >
void internal_forward_task_impl (buffer_operation *op, derived_type *derived)
 
virtual void internal_release (buffer_operation *op)
 
tasktry_put_task (const T &t) __TBB_override
 receive an item, return a task *if possible More...
 
graphgraph_reference () const __TBB_override
 
void reset_receiver (reset_flags) __TBB_override
 put receiver back in initial state More...
 
- Protected Member Functions inherited from internal::reservable_item_buffer< T, A >
bool reserve_front (T &v)
 
void consume_front ()
 
void release_front ()
 
- Protected Member Functions inherited from internal::item_buffer< T, A >
bool buffer_empty () const
 
buffer_item_typeitem (size_type i)
 
const buffer_item_typeitem (size_type i) const
 
bool my_item_valid (size_type i) const
 
bool my_item_reserved (size_type i) const
 
const item_typeget_my_item (size_t i) const
 
void set_my_item (size_t i, const item_type &o)
 
void fetch_item (size_t i, item_type &o)
 
void move_item (size_t to, size_t from)
 
bool place_item (size_t here, const item_type &me)
 
void swap_items (size_t i, size_t j)
 
void destroy_item (size_type i)
 
const item_typefront () const
 
const item_typeback () const
 
void reserve_item (size_type i)
 
void release_item (size_type i)
 
void destroy_front ()
 
void destroy_back ()
 
size_type size (size_t new_tail=0)
 
size_type capacity ()
 
bool buffer_full ()
 
void grow_my_array (size_t minimum_size)
 Grows the internal array. More...
 
bool push_back (item_type &v)
 
bool pop_back (item_type &v)
 
bool pop_front (item_type &v)
 
void clean_up_buffer (bool reset_pointers)
 
- Protected Member Functions inherited from tbb::flow::interface11::receiver< T >
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 bool is_continue_receiver ()
 
- Protected Member Functions inherited from tbb::flow::interface11::sender< T >
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...
 
- Protected Attributes inherited from tbb::flow::interface11::buffer_node< T, A >
internal::round_robin_cache< T, null_rw_mutexmy_successors
 
bool forwarder_busy
 
internal::aggregator< handler_type, buffer_operationmy_aggregator
 
- Protected Attributes inherited from tbb::flow::interface11::graph_node
graphmy_graph
 
graph_nodenext
 
graph_nodeprev
 
- Protected Attributes inherited from internal::reservable_item_buffer< T, A >
bool my_reserved
 
- Protected Attributes inherited from internal::item_buffer< T, A >
buffer_item_typemy_array
 
size_type my_array_size
 
size_type my_head
 
size_type my_tail
 
- Static Protected Attributes inherited from internal::item_buffer< T, A >
static const size_type initial_buffer_size = 4
 

Detailed Description

template<typename T, typename A = cache_aligned_allocator<T>>
class tbb::flow::interface11::sequencer_node< T, A >

Forwards messages in sequence order.

Definition at line 2299 of file flow_graph.h.

Member Typedef Documentation

◆ input_type

template<typename T , typename A = cache_aligned_allocator<T>>
typedef T tbb::flow::interface11::sequencer_node< T, A >::input_type

Definition at line 2304 of file flow_graph.h.

◆ output_type

template<typename T , typename A = cache_aligned_allocator<T>>
typedef T tbb::flow::interface11::sequencer_node< T, A >::output_type

Definition at line 2305 of file flow_graph.h.

◆ predecessor_type

template<typename T , typename A = cache_aligned_allocator<T>>
typedef receiver<input_type>::predecessor_type tbb::flow::interface11::sequencer_node< T, A >::predecessor_type

Definition at line 2306 of file flow_graph.h.

◆ sequencer_operation

template<typename T , typename A = cache_aligned_allocator<T>>
typedef buffer_node<T, A>::buffer_operation tbb::flow::interface11::sequencer_node< T, A >::sequencer_operation
protected

Definition at line 2345 of file flow_graph.h.

◆ size_type

template<typename T , typename A = cache_aligned_allocator<T>>
typedef buffer_node<T, A>::size_type tbb::flow::interface11::sequencer_node< T, A >::size_type
protected

Definition at line 2344 of file flow_graph.h.

◆ successor_type

template<typename T , typename A = cache_aligned_allocator<T>>
typedef sender<output_type>::successor_type tbb::flow::interface11::sequencer_node< T, A >::successor_type

Definition at line 2307 of file flow_graph.h.

Constructor & Destructor Documentation

◆ sequencer_node() [1/2]

template<typename T , typename A = cache_aligned_allocator<T>>
template<typename Sequencer >
__TBB_NOINLINE_SYM tbb::flow::interface11::sequencer_node< T, A >::sequencer_node ( graph g,
const Sequencer &  s 
)
inline

Constructor.

Definition at line 2311 of file flow_graph.h.

2311  : queue_node<T, A>(g),
2313  tbb::internal::fgt_node( CODEPTR(), tbb::internal::FLOW_SEQUENCER_NODE, &(this->my_graph),
2314  static_cast<receiver<input_type> *>(this),
2315  static_cast<sender<output_type> *>(this) );
2316  }

References CODEPTR, tbb::internal::fgt_node(), and tbb::flow::interface11::graph_node::my_graph.

Here is the call graph for this function:

◆ sequencer_node() [2/2]

template<typename T , typename A = cache_aligned_allocator<T>>
__TBB_NOINLINE_SYM tbb::flow::interface11::sequencer_node< T, A >::sequencer_node ( const sequencer_node< T, A > &  src)
inline

Copy constructor.

Definition at line 2327 of file flow_graph.h.

2327  : queue_node<T, A>(src),
2328  my_sequencer( src.my_sequencer->clone() ) {
2329  tbb::internal::fgt_node( CODEPTR(), tbb::internal::FLOW_SEQUENCER_NODE, &(this->my_graph),
2330  static_cast<receiver<input_type> *>(this),
2331  static_cast<sender<output_type> *>(this) );
2332  }

References CODEPTR, tbb::internal::fgt_node(), and tbb::flow::interface11::graph_node::my_graph.

Here is the call graph for this function:

◆ ~sequencer_node()

template<typename T , typename A = cache_aligned_allocator<T>>
tbb::flow::interface11::sequencer_node< T, A >::~sequencer_node ( )
inline

Destructor.

Definition at line 2335 of file flow_graph.h.

2335 { delete my_sequencer; }

References tbb::flow::interface11::sequencer_node< T, A >::my_sequencer.

Member Function Documentation

◆ internal_push()

template<typename T , typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface11::sequencer_node< T, A >::internal_push ( sequencer_operation op)
inlineprivatevirtual

Reimplemented from tbb::flow::interface11::buffer_node< T, A >.

Definition at line 2348 of file flow_graph.h.

2348  {
2349  size_type tag = (*my_sequencer)(*(op->elem));
2350 #if !TBB_DEPRECATED_SEQUENCER_DUPLICATES
2351  if (tag < this->my_head) {
2352  // have already emitted a message with this tag
2354  return false;
2355  }
2356 #endif
2357  // cannot modify this->my_tail now; the buffer would be inconsistent.
2358  size_t new_tail = (tag+1 > this->my_tail) ? tag+1 : this->my_tail;
2359 
2360  if (this->size(new_tail) > this->capacity()) {
2361  this->grow_my_array(this->size(new_tail));
2362  }
2363  this->my_tail = new_tail;
2364 
2365  const internal::op_stat res = this->place_item(tag, *(op->elem)) ? internal::SUCCEEDED : internal::FAILED;
2366  __TBB_store_with_release(op->status, res);
2367  return res ==internal::SUCCEEDED;
2368  }

References tbb::internal::__TBB_store_with_release(), internal::item_buffer< T, A >::capacity(), internal::FAILED, internal::item_buffer< T, A >::grow_my_array(), internal::item_buffer< T, A >::my_head, internal::item_buffer< T, A >::my_tail, internal::item_buffer< T, A >::place_item(), internal::item_buffer< T, A >::size(), and internal::SUCCEEDED.

Here is the call graph for this function:

Member Data Documentation

◆ my_sequencer

template<typename T , typename A = cache_aligned_allocator<T>>
internal::function_body< T, size_t >* tbb::flow::interface11::sequencer_node< T, A >::my_sequencer
private

The documentation for this class was generated from the following file:
internal::item_buffer::capacity
size_type capacity()
Definition: _flow_graph_item_buffer_impl.h:153
internal::SUCCEEDED
Definition: _flow_graph_types_impl.h:719
CODEPTR
#define CODEPTR()
Definition: _flow_graph_trace_impl.h:297
internal::item_buffer::my_tail
size_type my_tail
Definition: _flow_graph_item_buffer_impl.h:53
internal::op_stat
op_stat
Definition: _flow_graph_types_impl.h:719
tbb::flow::interface11::graph_node::my_graph
graph & my_graph
Definition: _flow_graph_impl.h:464
internal::item_buffer::my_head
size_type my_head
Definition: _flow_graph_item_buffer_impl.h:52
tbb::internal::__TBB_store_with_release
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:716
tbb::flow::interface11::sequencer_node::my_sequencer
internal::function_body< T, size_t > * my_sequencer
Definition: flow_graph.h:2300
internal::item_buffer::grow_my_array
void grow_my_array(size_t minimum_size)
Grows the internal array.
Definition: _flow_graph_item_buffer_impl.h:159
s
void const char const char int ITT_FORMAT __itt_group_sync s
Definition: ittnotify_static.h:91
internal::item_buffer::size
size_type size(size_t new_tail=0)
Definition: _flow_graph_item_buffer_impl.h:152
tbb::flow::interface11::sequencer_node::size_type
buffer_node< T, A >::size_type size_type
Definition: flow_graph.h:2344
internal::FAILED
Definition: _flow_graph_types_impl.h:719
internal::function_body_leaf
the leaf for function_body
Definition: _flow_graph_body_impl.h:128
tbb::internal::fgt_node
static void fgt_node(void *, string_index, void *, void *)
Definition: _flow_graph_trace_impl.h:326
internal::item_buffer::place_item
bool place_item(size_t here, const item_type &me)
Definition: _flow_graph_item_buffer_impl.h:107

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.