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

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface10::internal::item_buffer< T, A >:
Collaboration diagram for tbb::flow::interface10::internal::item_buffer< T, A >:

Public Types

enum  buffer_item_state { no_item =0, has_item =1, reserved_item =2 }
 
typedef T item_type
 

Public Member Functions

 item_buffer ()
 Constructor. More...
 
 ~item_buffer ()
 
void reset ()
 

Protected Types

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
 

Protected Member Functions

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 Attributes

buffer_item_typemy_array
 
size_type my_array_size
 
size_type my_head
 
size_type my_tail
 

Static Protected Attributes

static const size_type initial_buffer_size = 4
 

Detailed Description

template<typename T, typename A = cache_aligned_allocator<T>>
class tbb::flow::interface10::internal::item_buffer< T, A >

Definition at line 41 of file flow_graph.h.

Member Typedef Documentation

◆ allocator_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef A::template rebind<buffer_item_type>::other tbb::flow::interface10::internal::item_buffer< T, A >::allocator_type
protected

Definition at line 48 of file flow_graph.h.

◆ buffer_item_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef aligned_pair<item_type, buffer_item_state>::type tbb::flow::interface10::internal::item_buffer< T, A >::buffer_item_type
protected

Definition at line 47 of file flow_graph.h.

◆ item_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef T tbb::flow::interface10::internal::item_buffer< T, A >::item_type

Definition at line 43 of file flow_graph.h.

◆ size_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef size_t tbb::flow::interface10::internal::item_buffer< T, A >::size_type
protected

Definition at line 46 of file flow_graph.h.

Member Enumeration Documentation

◆ buffer_item_state

template<typename T, typename A = cache_aligned_allocator<T>>
enum tbb::flow::interface10::internal::item_buffer::buffer_item_state
Enumerator
no_item 
has_item 
reserved_item 

Definition at line 44 of file flow_graph.h.

Constructor & Destructor Documentation

◆ item_buffer()

template<typename T, typename A = cache_aligned_allocator<T>>
tbb::flow::interface10::internal::item_buffer< T, A >::item_buffer ( )
inline

Constructor.

Definition at line 232 of file flow_graph.h.

232  {
233  typedef T async_type;
234  typedef typename T::async_msg_data_type filtered_type;
235 

◆ ~item_buffer()

template<typename T, typename A = cache_aligned_allocator<T>>
tbb::flow::interface10::internal::item_buffer< T, A >::~item_buffer ( )
inline

Definition at line 237 of file flow_graph.h.

239  {

Member Function Documentation

◆ back()

template<typename T, typename A = cache_aligned_allocator<T>>
const item_type& tbb::flow::interface10::internal::item_buffer< T, A >::back ( ) const
inlineprotected

Definition at line 138 of file flow_graph.h.

139  {
140  built_edges.clear();
141  }
142 

◆ buffer_empty()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::internal::item_buffer< T, A >::buffer_empty ( ) const
inlineprotected

Definition at line 56 of file flow_graph.h.

56 {

◆ buffer_full()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::internal::item_buffer< T, A >::buffer_full ( )
inlineprotected

Definition at line 157 of file flow_graph.h.

162 {

◆ capacity()

template<typename T, typename A = cache_aligned_allocator<T>>
size_type tbb::flow::interface10::internal::item_buffer< T, A >::capacity ( )
inlineprotected

Definition at line 154 of file flow_graph.h.

162 {

Referenced by tbb::flow::interface10::sequencer_node< T, A >::internal_push().

Here is the caller graph for this function:

◆ clean_up_buffer()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::clean_up_buffer ( bool  reset_pointers)
inlineprotected

Definition at line 216 of file flow_graph.h.

224  {
225  // Incoming 't' is NOT async
226  return this_recv->try_put_task(from_void_ptr(p));
227  }
228  }
void const char const char int ITT_FORMAT __itt_group_sync p

◆ destroy_back()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::destroy_back ( )
inlineprotected

Definition at line 149 of file flow_graph.h.

162 {

◆ destroy_front()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::destroy_front ( )
inlineprotected

Definition at line 148 of file flow_graph.h.

148 :
149  edge_list_type built_edges;

Referenced by tbb::flow::interface10::queue_node< T, A >::try_put_and_add_task().

Here is the caller graph for this function:

◆ destroy_item()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::destroy_item ( size_type  i)
inlineprotected

Definition at line 124 of file flow_graph.h.

124  {
125  (void)built_edges.erase(i);
126  return; // only remove one predecessor per request
127  }
128  }

Referenced by tbb::flow::interface10::priority_queue_node< T, Compare, A >::prio_pop().

Here is the caller graph for this function:

◆ fetch_item()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::fetch_item ( size_t  i,
item_type o 
)
inlineprotected

Definition at line 90 of file flow_graph.h.

92  {};
93 

Referenced by tbb::flow::interface10::priority_queue_node< T, Compare, A >::heapify().

Here is the caller graph for this function:

◆ front()

template<typename T, typename A = cache_aligned_allocator<T>>
const item_type& tbb::flow::interface10::internal::item_buffer< T, A >::front ( ) const
inlineprotected

Definition at line 131 of file flow_graph.h.

131  {
132  v = built_edges;
133  }
134 
135  size_t edge_count() {

Referenced by tbb::flow::interface10::queue_node< T, A >::try_put_and_add_task().

Here is the caller graph for this function:

◆ get_my_item()

template<typename T, typename A = cache_aligned_allocator<T>>
const item_type& tbb::flow::interface10::internal::item_buffer< T, A >::get_my_item ( size_t  i) const
inlineprotected

◆ grow_my_array()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::grow_my_array ( size_t  minimum_size)
inlineprotected

Grows the internal array.

Definition at line 160 of file flow_graph.h.

162  {
163 namespace flow {
164 namespace interface10 {
165 
166 // enqueue left task if necessary. Returns the non-enqueued task if there is one.
167 static inline tbb::task *combine_tasks(graph& g, tbb::task * left, tbb::task * right) {
168  // if no RHS task, don't change left.
169  if (right == NULL) return left;
170  // right != NULL
171  if (left == NULL) return right;
172  if (left == SUCCESSFULLY_ENQUEUED) return right;
173  // left contains a task
174  if (right != SUCCESSFULLY_ENQUEUED) {
175  // both are valid tasks
177  return right;
178  }
179  return left;
180 }
181 
182 #if __TBB_PREVIEW_ASYNC_MSG
183 
184 template < typename T > class async_msg;
185 
Base class for user-defined tasks.
Definition: task.h:589
void spawn_in_graph_arena(graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
static tbb::task *const SUCCESSFULLY_ENQUEUED
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:167

Referenced by tbb::flow::interface10::sequencer_node< T, A >::internal_push(), and tbb::flow::interface10::priority_queue_node< T, Compare, A >::prio_push().

Here is the caller graph for this function:

◆ item() [1/2]

template<typename T, typename A = cache_aligned_allocator<T>>
buffer_item_type& tbb::flow::interface10::internal::item_buffer< T, A >::item ( size_type  i)
inlineprotected

Definition at line 58 of file flow_graph.h.

80  {

◆ item() [2/2]

template<typename T, typename A = cache_aligned_allocator<T>>
const buffer_item_type& tbb::flow::interface10::internal::item_buffer< T, A >::item ( size_type  i) const
inlineprotected

Definition at line 64 of file flow_graph.h.

80  {

◆ move_item()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::move_item ( size_t  to,
size_t  from 
)
inlineprotected

Definition at line 99 of file flow_graph.h.

101  {
102 
103 template<typename T, typename M> class successor_cache;
104 template<typename T, typename M> class broadcast_cache;
105 template<typename T, typename M> class round_robin_cache;

Referenced by tbb::flow::interface10::priority_queue_node< T, Compare, A >::heapify(), and tbb::flow::interface10::priority_queue_node< T, Compare, A >::prio_pop().

Here is the caller graph for this function:

◆ my_item_reserved()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::internal::item_buffer< T, A >::my_item_reserved ( size_type  i) const
inlineprotected

Definition at line 71 of file flow_graph.h.

80 {

◆ my_item_valid()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::internal::item_buffer< T, A >::my_item_valid ( size_type  i) const
inlineprotected

◆ place_item()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::internal::item_buffer< T, A >::place_item ( size_t  here,
const item_type me 
)
inlineprotected

◆ pop_back()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::internal::item_buffer< T, A >::pop_back ( item_type v)
inlineprotected

Definition at line 196 of file flow_graph.h.

197  {
198  return static_cast<const void*>(&t);
199  }
200 
201  static void* to_void_ptr(T& t) {
202  return static_cast<void*>(&t);
203  }

◆ pop_front()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::internal::item_buffer< T, A >::pop_front ( item_type v)
inlineprotected

Definition at line 205 of file flow_graph.h.

205  {
206  return *static_cast<const T*>(p);
207  }
208 
209  static T& from_void_ptr(void* p) {
210  return *static_cast<T*>(p);
211  }
212 
void const char const char int ITT_FORMAT __itt_group_sync p

Referenced by tbb::flow::interface10::queue_node< T, A >::internal_pop().

Here is the caller graph for this function:

◆ push_back()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::internal::item_buffer< T, A >::push_back ( item_type v)
inlineprotected

Definition at line 187 of file flow_graph.h.

191  {
192  typedef async_msg<T> async_type;
193  typedef T filtered_type;
194 

Referenced by tbb::flow::interface10::buffer_node< T, A >::internal_push().

Here is the caller graph for this function:

◆ release_item()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::release_item ( size_type  i)
inlineprotected

Definition at line 146 of file flow_graph.h.

148 :
149  edge_list_type built_edges;

◆ reserve_item()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::reserve_item ( size_type  i)
inlineprotected

Definition at line 145 of file flow_graph.h.

148 :
149  edge_list_type built_edges;

◆ reset()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::reset ( )
inline

Definition at line 241 of file flow_graph.h.

243 {

◆ set_my_item()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::set_my_item ( size_t  i,
const item_type o 
)
inlineprotected

Definition at line 81 of file flow_graph.h.

81  {
82 
84 enum concurrency { unlimited = 0, serial = 1 };
85 
86 namespace interface10 {
87 
concurrency
An enumeration the provides the two most common concurrency levels: unlimited and serial.
Definition: flow_graph.h:84

◆ size()

template<typename T, typename A = cache_aligned_allocator<T>>
size_type tbb::flow::interface10::internal::item_buffer< T, A >::size ( size_t  new_tail = 0)
inlineprotected

Definition at line 153 of file flow_graph.h.

162 {

Referenced by tbb::flow::interface10::sequencer_node< T, A >::internal_push().

Here is the caller graph for this function:

◆ swap_items()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::internal::item_buffer< T, A >::swap_items ( size_t  i,
size_t  j 
)
inlineprotected

Definition at line 117 of file flow_graph.h.

118  {
119  built_edges.push_back(&s);
120  }
121 
122  void delete_edge(C &s) {
void const char const char int ITT_FORMAT __itt_group_sync s

Referenced by tbb::flow::interface10::priority_queue_node< T, Compare, A >::reheap().

Here is the caller graph for this function:

Member Data Documentation

◆ initial_buffer_size

template<typename T, typename A = cache_aligned_allocator<T>>
const size_type tbb::flow::interface10::internal::item_buffer< T, A >::initial_buffer_size = 4
staticprotected

Definition at line 52 of file flow_graph.h.

◆ my_array

template<typename T, typename A = cache_aligned_allocator<T>>
buffer_item_type* tbb::flow::interface10::internal::item_buffer< T, A >::my_array
protected

Definition at line 50 of file flow_graph.h.

◆ my_array_size

template<typename T, typename A = cache_aligned_allocator<T>>
size_type tbb::flow::interface10::internal::item_buffer< T, A >::my_array_size
protected

◆ my_head

◆ my_tail


The documentation for this class was generated from the following file:

Copyright © 2005-2019 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.