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_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 398 of file _concurrent_queue_impl.h.

Constructor & Destructor Documentation

◆ concurrent_queue_iterator_base_v3() [1/3]

Default constructor.

Definition at line 665 of file _concurrent_queue_impl.h.

665  : my_rep(NULL), my_item(NULL) {
666 #if __TBB_GCC_OPTIMIZER_ORDERING_BROKEN
668 #endif
669  }
#define __TBB_compiler_fence()
Definition: icc_generic.h:55
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.

◆ concurrent_queue_iterator_base_v3() [2/3]

Copy constructor.

Definition at line 672 of file _concurrent_queue_impl.h.

673  : no_assign(), my_rep(NULL), my_item(NULL) {
674  assign(i);
675  }
Base class for types that should not be assigned.
Definition: tbb_stddef.h:324
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 694 of file _concurrent_queue_impl.h.

694  {
695  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
697  size_t k = my_rep->head_counter;
698  if( !my_rep->get_item(my_item, k) ) advance();
699 }
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 687 of file _concurrent_queue_impl.h.

687  {
688  cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
689  my_rep = NULL;
690  }
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 717 of file _concurrent_queue_impl.h.

717  {
718  __TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" );
719  size_t k = my_rep->head_counter;
721 #if TBB_USE_ASSERT
722  Value* tmp;
723  my_rep->get_item(tmp,k);
724  __TBB_ASSERT( my_item==tmp, NULL );
725 #endif /* TBB_USE_ASSERT */
726  size_t i = modulo_power_of_two( k/concurrent_queue_rep<Value>::n_queue, queue.my_rep->items_per_page );
727  if( i==queue.my_rep->items_per_page-1 ) {
729  root = root->next;
730  }
731  // advance k
732  my_rep->head_counter = ++k;
733  if( !my_rep->get_item(my_item, k) ) advance();
734 }
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:365
Internal representation of a ConcurrentQueue.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
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_rep * my_rep
Internal representation.
concurrent_queue_base_v3< T >::page * array[concurrent_queue_rep< T >::n_queue]
static size_t index(ticket k)
Map ticket to an array index.
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.

◆ 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 702 of file _concurrent_queue_impl.h.

702  {
703  if( my_rep!=other.my_rep ) {
704  if( my_rep ) {
705  cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
706  my_rep = NULL;
707  }
708  if( other.my_rep ) {
709  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
711  }
712  }
713  my_item = other.my_item;
714 }
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.

Referenced by tbb::internal::concurrent_queue_iterator_base_v3::concurrent_queue_iterator_base_v3().

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 804 of file _concurrent_queue_impl.h.

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

◆ 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 799 of file _concurrent_queue_impl.h.

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

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 653 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-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.