Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value > Class Template Reference

Constness-independent portion of concurrent_queue_iterator. More...

#include <_concurrent_queue_impl.h>

Collaboration diagram for tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >:

Protected Member Functions

 concurrent_queue_iterator_base_v3 ()
 Default constructor. More...
 
 concurrent_queue_iterator_base_v3 (const concurrent_queue_iterator_base_v3 &i)
 Copy constructor. More...
 
concurrent_queue_iterator_base_v3operator= (const concurrent_queue_iterator_base_v3 &i)
 
 concurrent_queue_iterator_base_v3 (const concurrent_queue_base_v3< Value > &queue)
 Construct iterator pointing to head of queue. More...
 
void assign (const concurrent_queue_iterator_base_v3< Value > &other)
 Assignment. More...
 
void advance ()
 Advance iterator one step towards tail of queue. More...
 
 ~concurrent_queue_iterator_base_v3 ()
 Destructor. More...
 

Protected Attributes

Value * my_item
 Pointer to current item. More...
 

Private Attributes

concurrent_queue_iterator_rep< Value > * my_rep
 Represents concurrent_queue over which we are iterating. More...
 

Friends

template<typename C , typename T , typename U >
bool operator== (const concurrent_queue_iterator< C, T > &i, const concurrent_queue_iterator< C, U > &j)
 
template<typename C , typename T , typename U >
bool operator!= (const concurrent_queue_iterator< C, T > &i, const concurrent_queue_iterator< C, U > &j)
 

Detailed Description

template<typename Value>
class tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >

Constness-independent portion of concurrent_queue_iterator.

Definition at line 394 of file _concurrent_queue_impl.h.

Constructor & Destructor Documentation

◆ concurrent_queue_iterator_base_v3() [1/3]

Default constructor.

Definition at line 661 of file _concurrent_queue_impl.h.

661  : my_rep(NULL), my_item(NULL) {
662 #if __TBB_GCC_OPTIMIZER_ORDERING_BROKEN
664 #endif
665  }

References __TBB_compiler_fence.

◆ concurrent_queue_iterator_base_v3() [2/3]

Copy constructor.

Definition at line 668 of file _concurrent_queue_impl.h.

669  : my_rep(NULL), my_item(NULL) {
670  assign(i);
671  }

◆ concurrent_queue_iterator_base_v3() [3/3]

template<typename Value >
tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::concurrent_queue_iterator_base_v3 ( const concurrent_queue_base_v3< Value > &  queue)
protected

Construct iterator pointing to head of queue.

Definition at line 695 of file _concurrent_queue_impl.h.

695  {
696  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
698  size_t k = my_rep->head_counter;
699  if( !my_rep->get_item(my_item, k) ) advance();
700 }

References tbb::strict_ppl::internal::concurrent_queue_iterator_rep< T >::head_counter.

◆ ~concurrent_queue_iterator_base_v3()

Destructor.

Definition at line 688 of file _concurrent_queue_impl.h.

688  {
689  cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
690  my_rep = NULL;
691  }

Member Function Documentation

◆ advance()

template<typename Value >
void tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::advance
protected

Advance iterator one step towards tail of queue.

Definition at line 718 of file _concurrent_queue_impl.h.

718  {
719  __TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" );
720  size_t k = my_rep->head_counter;
722 #if TBB_USE_ASSERT
723  Value* tmp;
724  my_rep->get_item(tmp,k);
725  __TBB_ASSERT( my_item==tmp, NULL );
726 #endif /* TBB_USE_ASSERT */
727  size_t i = modulo_power_of_two( k/concurrent_queue_rep<Value>::n_queue, queue.my_rep->items_per_page );
728  if( i==queue.my_rep->items_per_page-1 ) {
730  root = root->next;
731  }
732  // advance k
733  my_rep->head_counter = ++k;
734  if( !my_rep->get_item(my_item, k) ) advance();
735 }

References __TBB_ASSERT, tbb::strict_ppl::internal::concurrent_queue_rep< T >::index(), tbb::internal::modulo_power_of_two(), and tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::my_rep.

Here is the call graph for this function:

◆ assign()

template<typename Value >
void tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::assign ( const concurrent_queue_iterator_base_v3< Value > &  other)
protected

Assignment.

Definition at line 703 of file _concurrent_queue_impl.h.

703  {
704  if( my_rep!=other.my_rep ) {
705  if( my_rep ) {
706  cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
707  my_rep = NULL;
708  }
709  if( other.my_rep ) {
710  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
712  }
713  }
714  my_item = other.my_item;
715 }

References tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::my_item, and tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::my_rep.

Referenced by tbb::internal::concurrent_queue_iterator_base_v3::concurrent_queue_iterator_base_v3(), and tbb::internal::concurrent_queue_iterator_base_v3::operator=().

Here is the caller graph for this function:

◆ operator=()

template<typename Value >
concurrent_queue_iterator_base_v3& tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::operator= ( const concurrent_queue_iterator_base_v3< Value > &  i)
inlineprotected

Definition at line 673 of file _concurrent_queue_impl.h.

673  {
674  assign(i);
675  return *this;
676  }

Referenced by tbb::internal::concurrent_queue_iterator< Container, Value >::operator=().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator!=

template<typename Value >
template<typename C , typename T , typename U >
bool operator!= ( const concurrent_queue_iterator< C, T > &  i,
const concurrent_queue_iterator< C, U > &  j 
)
friend

Definition at line 805 of file _concurrent_queue_impl.h.

805  {
806  return i.my_item!=j.my_item;
807 }

◆ operator==

template<typename Value >
template<typename C , typename T , typename U >
bool operator== ( const concurrent_queue_iterator< C, T > &  i,
const concurrent_queue_iterator< C, U > &  j 
)
friend

Definition at line 800 of file _concurrent_queue_impl.h.

800  {
801  return i.my_item==j.my_item;
802 }

Member Data Documentation

◆ my_item

template<typename Value >
Value* tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::my_item
protected

Pointer to current item.

Definition at line 658 of file _concurrent_queue_impl.h.

Referenced by tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::assign().

◆ my_rep

template<typename Value >
concurrent_queue_iterator_rep<Value>* tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::my_rep
private

Represents concurrent_queue over which we are iterating.

NULL if one past last element in queue.

Definition at line 649 of file _concurrent_queue_impl.h.

Referenced by tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::assign().


The documentation for this class was generated from the following file:
tbb::internal::concurrent_queue_base_v3::my_rep
concurrent_queue_rep * my_rep
Internal representation.
Definition: _concurrent_queue_impl.h:829
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::strict_ppl::internal::concurrent_queue_iterator_rep::my_queue
const concurrent_queue_base_v3< T > & my_queue
Definition: _concurrent_queue_impl.h:615
tbb::internal::concurrent_queue_iterator_rep
Definition: concurrent_queue.cpp:580
tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3::assign
void assign(const concurrent_queue_iterator_base_v3< Value > &other)
Assignment.
Definition: _concurrent_queue_impl.h:703
tbb::strict_ppl::internal::concurrent_queue_iterator_rep::get_item
bool get_item(T *&item, size_t k)
Set item to point to kth element. Return true if at end of queue or item is marked valid; false other...
Definition: _concurrent_queue_impl.h:630
tbb::strict_ppl::internal::concurrent_queue_rep::index
static size_t index(ticket k)
Map ticket to an array index.
Definition: _concurrent_queue_impl.h:405
tbb::internal::concurrent_queue_iterator_base_v3::my_rep
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.
Definition: _concurrent_queue_impl.h:963
tbb::internal::concurrent_queue_iterator_base_v3::my_item
void * my_item
Pointer to current item.
Definition: _concurrent_queue_impl.h:974
tbb::strict_ppl::internal::concurrent_queue_iterator_rep::array
concurrent_queue_base_v3< T >::page * array[concurrent_queue_rep< T >::n_queue]
Definition: _concurrent_queue_impl.h:616
tbb::strict_ppl::internal::concurrent_queue_iterator_rep::head_counter
ticket head_counter
Definition: _concurrent_queue_impl.h:614
tbb::internal::concurrent_queue_rep
Internal representation of a ConcurrentQueue.
Definition: concurrent_queue.cpp:112
tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3::my_item
Value * my_item
Pointer to current item.
Definition: _concurrent_queue_impl.h:658
tbb::internal::modulo_power_of_two
argument_integer_type modulo_power_of_two(argument_integer_type arg, divisor_integer_type divisor)
A function to compute arg modulo divisor where divisor is a power of 2.
Definition: tbb_stddef.h:382
tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3::advance
void advance()
Advance iterator one step towards tail of queue.
Definition: _concurrent_queue_impl.h:718
tbb::internal::concurrent_queue_base_v3
For internal use only.
Definition: _concurrent_queue_impl.h:826
tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3::my_rep
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.
Definition: _concurrent_queue_impl.h:649
__TBB_compiler_fence
#define __TBB_compiler_fence()
Definition: icc_generic.h:51

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.