tbb::buffer_node< T > Class Template Reference

Forwards messages in arbitrary order. More...

#include <graph.h>

Inheritance diagram for tbb::buffer_node< T >:

tbb::graph_node tbb::receiver< T > tbb::sender< T > tbb::queue_node< T > tbb::priority_queue_node< T, Compare > tbb::sequencer_node< T > List of all members.

Public Types

typedef T input_type
 The input type of this receiver.
typedef T output_type
 The output type of this sender.
typedef sender< input_typepredecessor_type
 The predecessor type for this node.
typedef receiver< output_typesuccessor_type
 The successor type for this node.

Public Member Functions

 buffer_node (graph &g)
 Constructor.
bool register_successor (receiver< output_type > &r)
 Adds a new successor.
bool remove_successor (receiver< output_type > &r)
 Removes a successor.
bool try_get (T &v)
 Request an item from the queue_node.
bool try_reserve (T &v)
 Reserves an item.
bool try_release ()
 Release a reserved item.
bool try_consume ()
 Consumes a reserved item.
bool try_put (T t)
 Receive an item.

Protected Types

typedef size_t size_type
typedef std::pair< T, bool > item_type
 reg_succ
 rem_succ
 req_item
 res_item
 rel_res
 con_res
 put_item
 try_fwd
enum  operation_type {
  reg_succ, rem_succ, req_item, res_item,
  rel_res, con_res, put_item, try_fwd
}

Protected Member Functions

virtual void forward ()
 This is executed by an enqueued task, the "forwarder".
virtual void internal_forward (buffer_operation *op)
 Tries to forward valid items to successors.
virtual void internal_push (buffer_operation *op)
virtual void internal_pop (buffer_operation *op)
virtual void internal_reserve (buffer_operation *op)
virtual void internal_consume (buffer_operation *op)
void grow_my_array (size_t minimum_size)
 Grows the internal array.

Protected Attributes

internal::round_robin_cache<
T, null_rw_mutex
my_successors
taskmy_parent
item_type * my_array
size_type my_array_size
size_type my_head
size_type my_tail
tbb::spin_mutex my_mutex
bool my_reserved
size_type my_reserved_id
my_agg_t * my_aggregator

Static Protected Attributes

static const size_type initial_buffer_size = 4

Friends

class internal::forward_task< buffer_node< T > >

Classes

class  buffer_operation
class  my_agg_t

Detailed Description

template<typename T>
class tbb::buffer_node< T >

Forwards messages in arbitrary order.


Member Function Documentation

template<typename T>
bool tbb::buffer_node< T >::register_successor ( receiver< output_type > &  r  )  [inline, virtual]

Adds a new successor.

Adds successor r to the list of successors; may forward tasks.

Implements tbb::sender< T >.

template<typename T>
bool tbb::buffer_node< T >::remove_successor ( receiver< output_type > &  r  )  [inline, virtual]

Removes a successor.

Removes successor r from the list of successors. It also calls r.remove_predecessor(*this) to remove this node as a predecessor.

Implements tbb::sender< T >.

template<typename T>
bool tbb::buffer_node< T >::try_consume (  )  [inline, virtual]

Consumes a reserved item.

true = item is removed from sender and reservation removed

Reimplemented from tbb::sender< T >.

template<typename T>
bool tbb::buffer_node< T >::try_get ( T &  v  )  [inline, virtual]

Request an item from the queue_node.

true = v contains the returned item
false = no item has been returned

Reimplemented from tbb::sender< T >.

template<typename T>
bool tbb::buffer_node< T >::try_put ( t  )  [inline, virtual]

Receive an item.

true is always returned

Implements tbb::receiver< T >.

template<typename T>
bool tbb::buffer_node< T >::try_release (  )  [inline, virtual]

Release a reserved item.

true = item has been released and so remains in sender

Reimplemented from tbb::sender< T >.

template<typename T>
bool tbb::buffer_node< T >::try_reserve ( T &  v  )  [inline, virtual]

Reserves an item.

false = no item can be reserved
true = an item is reserved

Reimplemented from tbb::sender< T >.


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

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