tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value > Class Template Reference
Containers

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 & | operator= (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 646 of file _concurrent_queue_impl.h.

## Constructor & Destructor Documentation

## concurrent_queue_iterator_base_v3() [1/3]

template<typename Value >

tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::concurrent_queue_iterator_base_v3 | ( |  | ) |

inline protected

Default constructor.

Definition at line 661 of file _concurrent_queue_impl.h.

: my_rep(NULL), my_item(NULL) {
#if __TBB_GCC_OPTIMIZER_ORDERING_BROKEN
__TBB_compiler_fence();
#endif
}
__TBB_compiler_fence
#define __TBB_compiler_fence()
Definition: icc_generic.h:51
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::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

References __TBB_compiler_fence.

## concurrent_queue_iterator_base_v3() [2/3]

template<typename Value >

tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::concurrent_queue_iterator_base_v3 | ( | const concurrent_queue_iterator_base_v3< Value > & | i | ) |

inline protected

Copy constructor.

Definition at line 668 of file _concurrent_queue_impl.h.

: my_rep(NULL), my_item(NULL) {
assign(i);
}
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

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

{
my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
new( my_rep ) concurrent_queue_iterator_rep<Value>(queue);
size_t k = my_rep->head_counter;
if( !my_rep->get_item(my_item, k) ) advance();
}
tbb::strict_ppl::internal::concurrent_queue_iterator_rep::head_counter
ticket head_counter
Definition: _concurrent_queue_impl.h:614
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_iterator_base_v3::advance
void advance()
Advance iterator one step towards tail of queue.
Definition: _concurrent_queue_impl.h:718
tbb::internal::concurrent_queue_iterator_rep
Definition: concurrent_queue.cpp:580

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

## ~concurrent_queue_iterator_base_v3()

template<typename Value >

tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::~concurrent_queue_iterator_base_v3 | ( |  | ) |

inline protected

Destructor.

Definition at line 688 of file _concurrent_queue_impl.h.

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

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

{
__TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" );
size_t k = my_rep->head_counter;
const concurrent_queue_base_v3<Value>& queue = my_rep->my_queue;
#if TBB_USE_ASSERT
Value* tmp;
my_rep->get_item(tmp,k);
__TBB_ASSERT( my_item==tmp, NULL );
#endif /* TBB_USE_ASSERT */
size_t i = modulo_power_of_two( k/concurrent_queue_rep<Value>::n_queue, queue.my_rep->items_per_page );
if( i==queue.my_rep->items_per_page-1 ) {
typename concurrent_queue_base_v3<Value>::page*& root = my_rep->array[concurrent_queue_rep<Value>::index(k)];
root = root->next;
}
// advance k
my_rep->head_counter = ++k;
if( !my_rep->get_item(my_item, k) ) advance();
}
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
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_rep::index
static size_t index(ticket k)
Map ticket to an array index.
Definition: _concurrent_queue_impl.h:405
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::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::internal::concurrent_queue_base_v3
For internal use only.
Definition: _concurrent_queue_impl.h:826
tbb::internal::concurrent_queue_base_v3::my_rep
concurrent_queue_rep * my_rep
Internal representation.
Definition: _concurrent_queue_impl.h:829
tbb::internal::concurrent_queue_base_v3::page
Prefix on a page.
Definition: _concurrent_queue_impl.h:838
tbb::internal::concurrent_queue_base_v3::page::next
page * next
Definition: _concurrent_queue_impl.h:839
tbb::internal::concurrent_queue_rep
Internal representation of a ConcurrentQueue.
Definition: concurrent_queue.cpp:112

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

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.

{
if( my_rep!=other.my_rep ) {
if( my_rep ) {
cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
my_rep = NULL;
}
if( other.my_rep ) {
my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
new( my_rep ) concurrent_queue_iterator_rep<Value>( *other.my_rep );
}
}
my_item = other.my_item;
}
tbb::internal::concurrent_queue_iterator_base_v3::my_item
void * my_item
Pointer to current item.
Definition: _concurrent_queue_impl.h:974
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

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

inline protected

Definition at line 673 of file _concurrent_queue_impl.h.

{
assign(i);
return *this;
}

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.

{
return i.my_item!=j.my_item;
}

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

{
return i.my_item==j.my_item;
}

## 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:

- _concurrent_queue_impl.h

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.