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 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  : no_assign(), my_rep(NULL), my_item(NULL) {
670  assign(i);
671  }
concurrent_queue_iterator_rep< Value > * my_rep
Represents concurrent_queue over which we are iterating.
void assign(const concurrent_queue_iterator_base_v3< Value > &other)
Assignment.
Base class for types that should not be assigned.
Definition: tbb_stddef.h:320

◆ concurrent_queue_iterator_base_v3() [3/3]

Construct iterator pointing to head of queue.

Definition at line 690 of file _concurrent_queue_impl.h.

690  {
691  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
693  size_t k = my_rep->head_counter;
694  if( !my_rep->get_item(my_item, k) ) advance();
695 }
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.
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...

◆ ~concurrent_queue_iterator_base_v3()

Destructor.

Definition at line 683 of file _concurrent_queue_impl.h.

683  {
684  cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
685  my_rep = NULL;
686  }
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 713 of file _concurrent_queue_impl.h.

713  {
714  __TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" );
715  size_t k = my_rep->head_counter;
717 #if TBB_USE_ASSERT
718  Value* tmp;
719  my_rep->get_item(tmp,k);
720  __TBB_ASSERT( my_item==tmp, NULL );
721 #endif /* TBB_USE_ASSERT */
722  size_t i = modulo_power_of_two( k/concurrent_queue_rep<Value>::n_queue, queue.my_rep->items_per_page );
723  if( i==queue.my_rep->items_per_page-1 ) {
725  root = root->next;
726  }
727  // advance k
728  my_rep->head_counter = ++k;
729  if( !my_rep->get_item(my_item, k) ) advance();
730 }
static size_t index(ticket k)
Map ticket to an array index.
concurrent_queue_rep * my_rep
Internal representation.
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.
Internal representation of a ConcurrentQueue.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
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:361
concurrent_queue_base_v3< T >::page * array[concurrent_queue_rep< T >::n_queue]
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...

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

698  {
699  if( my_rep!=other.my_rep ) {
700  if( my_rep ) {
701  cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
702  my_rep = NULL;
703  }
704  if( other.my_rep ) {
705  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
707  }
708  }
709  my_item = other.my_item;
710 }
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().

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

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

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

795  {
796  return i.my_item==j.my_item;
797 }

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