Home ⌂Doc Index ◂Up ▴
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>

Inheritance diagram for tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >:
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  }
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.
#define __TBB_compiler_fence()
Definition: icc_generic.h:51

◆ 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  }
void assign(const concurrent_queue_iterator_base_v3< Value > &other)
Assignment.
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.

◆ concurrent_queue_iterator_base_v3() [3/3]

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 }
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...
void advance()
Advance iterator one step towards tail of queue.
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.

◆ ~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  }
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.

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 }
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
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...
static size_t index(ticket k)
Map ticket to an array index.
void advance()
Advance iterator one step towards tail of queue.
Internal representation of a ConcurrentQueue.
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.
concurrent_queue_base_v3< T >::page * array[concurrent_queue_rep< T >::n_queue]
concurrent_queue_rep * my_rep
Internal representation.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

◆ 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 }
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.

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  }
void assign(const concurrent_queue_iterator_base_v3< Value > &other)
Assignment.

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

◆ 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< tbb_remove_cv< Value >::type >::assign().


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

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.