tbb::interface5::internal::hash_map_iterator< Container, Value > Class Template Reference
Containers

Meets requirements of a forward iterator for STL *‍/. More...

`#include <concurrent_hash_map.h>`

Inheritance diagram for tbb::interface5::internal::hash_map_iterator< Container, Value >:
Collaboration diagram for tbb::interface5::internal::hash_map_iterator< Container, Value >:

## Public Member Functions

| hash_map_iterator ()
| Construct undefined iterator. More...
| hash_map_iterator (const hash_map_iterator< Container, typename Container::value_type > &other)
hash_map_iterator & | operator= (const hash_map_iterator< Container, typename Container::value_type > &other)
Value & | operator* () const
Value * | operator-> () const
hash_map_iterator & | operator++ ()
hash_map_iterator | operator++ (int)
| Post increment. More...

## Private Types

typedef Container | map_type
typedef Container::node | node
typedef hash_map_base::node_base | node_base
typedef hash_map_base::bucket | bucket

## Private Member Functions

void | advance_to_next_bucket ()
| hash_map_iterator (const Container &map, size_t index, const bucket *b, node_base *n)

## Private Attributes

const Container * | my_map
| concurrent_hash_map over which we are iterating. More...
size_t | my_index
| Index in hash table for current item. More...
const bucket * | my_bucket
| Pointer to bucket. More...
node * | my_node
| Pointer to node that has current item. More...

## Friends

template<typename C , typename U >
class | hash_map_iterator
template<typename I >
class | hash_map_range
template<typename Key , typename T , typename HashCompare , typename A >
class | interface5::concurrent_hash_map
template<typename C , typename T , typename U >
bool | operator== (const hash_map_iterator< C, T > &i, const hash_map_iterator< C, U > &j)
template<typename C , typename T , typename U >
bool | operator!= (const hash_map_iterator< C, T > &i, const hash_map_iterator< C, U > &j)
template<typename C , typename T , typename U >
ptrdiff_t | operator- (const hash_map_iterator< C, T > &i, const hash_map_iterator< C, U > &j)

## Detailed Description

### template<typename Container, typename Value>
class tbb::interface5::internal::hash_map_iterator< Container, Value >

Meets requirements of a forward iterator for STL *‍/.

Value is either the T or const T type of the container.

Definition at line 346 of file concurrent_hash_map.h.

## Member Typedef Documentation

## bucket

template<typename Container, typename Value>

typedef hash_map_base::bucket tbb::interface5::internal::hash_map_iterator< Container, Value >::bucket

private

Definition at line 352 of file concurrent_hash_map.h.

## map_type

template<typename Container, typename Value>

typedef Container tbb::interface5::internal::hash_map_iterator< Container, Value >::map_type

private

Definition at line 349 of file concurrent_hash_map.h.

## node

template<typename Container, typename Value>

typedef Container::node tbb::interface5::internal::hash_map_iterator< Container, Value >::node

private

Definition at line 350 of file concurrent_hash_map.h.

## node_base

template<typename Container, typename Value>

typedef hash_map_base::node_base tbb::interface5::internal::hash_map_iterator< Container, Value >::node_base

private

Definition at line 351 of file concurrent_hash_map.h.

## Constructor & Destructor Documentation

## hash_map_iterator() [1/3]

template<typename Container , typename Value >

tbb::interface5::internal::hash_map_iterator< Container, Value >::hash_map_iterator | ( | const Container & | map,
|  | size_t | index,
|  | const bucket * | b,
|  | node_base * | n
| ) |  |

private

Definition at line 438 of file concurrent_hash_map.h.

:
my_map(&map),
my_index(index),
my_bucket(b),
my_node( static_cast<node*>(n) )
{
if( b && !hash_map_base::is_valid(n) )
advance_to_next_bucket();
}

References tbb::interface5::internal::hash_map_iterator< Container, Value >::advance_to_next_bucket(), and tbb::interface5::internal::hash_map_base::is_valid().

Here is the call graph for this function:

## hash_map_iterator() [2/3]

template<typename Container, typename Value>

tbb::interface5::internal::hash_map_iterator< Container, Value >::hash_map_iterator | ( |  | ) |

inline

Construct undefined iterator.

Definition at line 407 of file concurrent_hash_map.h.

: my_map(), my_index(), my_bucket(), my_node() {}

## hash_map_iterator() [3/3]

template<typename Container, typename Value>

tbb::interface5::internal::hash_map_iterator< Container, Value >::hash_map_iterator | ( | const hash_map_iterator< Container, typename Container::value_type > & | other | ) |

inline

Definition at line 408 of file concurrent_hash_map.h.

:
my_map(other.my_map),
my_index(other.my_index),
my_bucket(other.my_bucket),
my_node(other.my_node)
{}

## Member Function Documentation

## advance_to_next_bucket()

template<typename Container, typename Value>

void tbb::interface5::internal::hash_map_iterator< Container, Value >::advance_to_next_bucket | ( |  | ) |

inline private

Definition at line 369 of file concurrent_hash_map.h.

{ // TODO?: refactor to iterator_base class
size_t k = my_index+1;
__TBB_ASSERT( my_bucket, "advancing an invalid iterator?");
while( k <= my_map->my_mask ) {
// Following test uses 2's-complement wizardry
if( k&(k-2) ) // not the beginning of a segment
++my_bucket;
else my_bucket = my_map->get_bucket( k );
my_node = static_cast<node*>( my_bucket->node_list );
if( hash_map_base::is_valid(my_node) ) {
my_index = k; return;
}
++k;
}
my_bucket = 0; my_node = 0; my_index = k; // the end
}

References __TBB_ASSERT, and tbb::interface5::internal::hash_map_base::is_valid().

Referenced by tbb::interface5::internal::hash_map_iterator< Container, Value >::hash_map_iterator().

Here is the call graph for this function:
Here is the caller graph for this function:

## operator*()

template<typename Container, typename Value>

Value& tbb::interface5::internal::hash_map_iterator< Container, Value >::operator* | ( |  | ) | const

inline

Definition at line 422 of file concurrent_hash_map.h.

{
__TBB_ASSERT( hash_map_base::is_valid(my_node), "iterator uninitialized or at end of container?" );
return my_node->value();
}

References __TBB_ASSERT, and tbb::interface5::internal::hash_map_base::is_valid().

Here is the call graph for this function:

## operator++() [1/2]

template<typename Container , typename Value >

hash_map_iterator< Container, Value > & tbb::interface5::internal::hash_map_iterator< Container, Value >::operator++ | ( |  | ) |

Definition at line 449 of file concurrent_hash_map.h.

{
my_node = static_cast<node*>( my_node->next );
if( !my_node ) advance_to_next_bucket();
return *this;
}

## operator++() [2/2]

template<typename Container, typename Value>

hash_map_iterator tbb::interface5::internal::hash_map_iterator< Container, Value >::operator++ | ( | int |  | ) |

inline

Post increment.

Definition at line 430 of file concurrent_hash_map.h.

{
hash_map_iterator old(*this);
operator++();
return old;
}

## operator->()

template<typename Container, typename Value>

Value* tbb::interface5::internal::hash_map_iterator< Container, Value >::operator-> | ( |  | ) | const

inline

Definition at line 426 of file concurrent_hash_map.h.

{return &operator*();}

## operator=()

template<typename Container, typename Value>

hash_map_iterator& tbb::interface5::internal::hash_map_iterator< Container, Value >::operator= | ( | const hash_map_iterator< Container, typename Container::value_type > & | other | ) |

inline

Definition at line 415 of file concurrent_hash_map.h.

{
my_map = other.my_map;
my_index = other.my_index;
my_bucket = other.my_bucket;
my_node = other.my_node;
return *this;
}

References tbb::interface5::internal::hash_map_iterator< Container, Value >::my_bucket, tbb::interface5::internal::hash_map_iterator< Container, Value >::my_index, tbb::interface5::internal::hash_map_iterator< Container, Value >::my_map, and tbb::interface5::internal::hash_map_iterator< Container, Value >::my_node.

## Friends And Related Function Documentation

## hash_map_iterator

template<typename Container, typename Value>
template<typename C , typename U >

friend class hash_map_iterator

friend

Definition at line 364 of file concurrent_hash_map.h.

## hash_map_range

template<typename Container, typename Value>
template<typename I >

friend class hash_map_range

friend

Definition at line 367 of file concurrent_hash_map.h.

## interface5::concurrent_hash_map

template<typename Container, typename Value>
template<typename Key , typename T , typename HashCompare , typename A >

friend class interface5::concurrent_hash_map

friend

Definition at line 387 of file concurrent_hash_map.h.

## operator!=

template<typename Container, typename Value>
template<typename C , typename T , typename U >

bool operator!= | ( | const hash_map_iterator< C, T > & | i,
|  | const hash_map_iterator< C, U > & | j
| ) |  |

friend

## operator-

template<typename Container, typename Value>
template<typename C , typename T , typename U >

ptrdiff_t operator- | ( | const hash_map_iterator< C, T > & | i,
|  | const hash_map_iterator< C, U > & | j
| ) |  |

friend

## operator==

template<typename Container, typename Value>
template<typename C , typename T , typename U >

bool operator== | ( | const hash_map_iterator< C, T > & | i,
|  | const hash_map_iterator< C, U > & | j
| ) |  |

friend

## Member Data Documentation

## my_bucket

template<typename Container, typename Value>

const bucket* tbb::interface5::internal::hash_map_iterator< Container, Value >::my_bucket

private

Pointer to bucket.

Definition at line 398 of file concurrent_hash_map.h.

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

## my_index

template<typename Container, typename Value>

size_t tbb::interface5::internal::hash_map_iterator< Container, Value >::my_index

private

Index in hash table for current item.

Definition at line 395 of file concurrent_hash_map.h.

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

## my_map

template<typename Container, typename Value>

const Container* tbb::interface5::internal::hash_map_iterator< Container, Value >::my_map

private

concurrent_hash_map over which we are iterating.

Definition at line 392 of file concurrent_hash_map.h.

Referenced by tbb::interface5::internal::operator!=(), tbb::interface5::internal::hash_map_iterator< Container, Value >::operator=(), and tbb::interface5::internal::operator==().

## my_node

template<typename Container, typename Value>

node* tbb::interface5::internal::hash_map_iterator< Container, Value >::my_node

private

Pointer to node that has current item.

Definition at line 401 of file concurrent_hash_map.h.

Referenced by tbb::interface5::internal::operator!=(), tbb::interface5::internal::hash_map_iterator< Container, Value >::operator=(), and tbb::interface5::internal::operator==().

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

- concurrent_hash_map.h

__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::interface5::internal::hash_map_iterator::my_bucket
const bucket * my_bucket
Pointer to bucket.
Definition: concurrent_hash_map.h:398
tbb::interface5::internal::hash_map_base::bucket::node_list
node_base * node_list
Definition: concurrent_hash_map.h:99
tbb::interface5::internal::hash_map_iterator::my_node
node * my_node
Pointer to node that has current item.
Definition: concurrent_hash_map.h:401
tbb::interface5::internal::hash_map_iterator::hash_map_iterator
hash_map_iterator()
Construct undefined iterator.
Definition: concurrent_hash_map.h:407
tbb::interface5::internal::hash_map_iterator::my_map
const Container * my_map
concurrent_hash_map over which we are iterating.
Definition: concurrent_hash_map.h:392
tbb::interface5::internal::hash_map_iterator::advance_to_next_bucket
void advance_to_next_bucket()
Definition: concurrent_hash_map.h:369
tbb::interface5::internal::hash_map_iterator::my_index
size_t my_index
Index in hash table for current item.
Definition: concurrent_hash_map.h:395
tbb::interface5::internal::hash_map_base::is_valid
static bool is_valid(void *ptr)
Definition: concurrent_hash_map.h:159
tbb::interface5::internal::hash_map_iterator::operator*
Value & operator*() const
Definition: concurrent_hash_map.h:422
tbb::interface5::internal::hash_map_iterator::operator++
hash_map_iterator & operator++()
Definition: concurrent_hash_map.h:449

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.