Public Member Functions | Protected Member Functions | Private Attributes
HashTable::iteratorBase Class Reference

The iterator base for HashTable. More...

Inheritance diagram for HashTable::iteratorBase:
Inheritance graph
[legend]
Collaboration diagram for HashTable::iteratorBase:
Collaboration graph
[legend]

Public Member Functions

const Key & key () const
 Return the Key corresponding to the iterator. More...
 
bool operator== (const iteratorBase &) const
 Compare hashedEntry element pointers. More...
 
bool operator!= (const iteratorBase &) const
 
bool operator== (const iteratorEnd &unused) const
 Compare hashedEntry to iteratorEnd pointers. More...
 
bool operator!= (const iteratorEnd &unused) const
 

Protected Member Functions

 iteratorBase ()
 Construct null - equivalent to an 'end' position. More...
 
 iteratorBase (const HashTable< T, Key, Hash > *curHashTable)
 Construct from hash table, moving to its 'begin' position. More...
 
 iteratorBase (const HashTable< T, Key, Hash > *curHashTable, const hashedEntry *elmt, const label hashIndex)
 Construct from hash table, element and hash index. More...
 
void increment ()
 Increment to the next position. More...
 
bool erase ()
 Erase the HashTable element at the current position. More...
 
Tobject ()
 Return non-const access to referenced object. More...
 
const Tcobject () const
 Return const access to referenced object. More...
 

Private Attributes

HashTable< T, Key, Hash > * hashTable_
 Pointer to the HashTable for which this is an iterator. More...
 
hashedEntryentryPtr_
 Current element. More...
 
label hashIndex_
 Current hash index. More...
 

Detailed Description

The iterator base for HashTable.

Note: data and functions are protected, to allow reuse by iterator and prevent most external usage. iterator and const_iterator have the same size, allowing us to reinterpret_cast between them (if desired)

Definition at line 343 of file HashTable.H.

Constructor & Destructor Documentation

◆ iteratorBase() [1/3]

iteratorBase ( )
inlineprotected

Construct null - equivalent to an 'end' position.

Definition at line 162 of file HashTableI.H.

◆ iteratorBase() [2/3]

iteratorBase ( const HashTable< T, Key, Hash > *  curHashTable)
inlineexplicitprotected

Construct from hash table, moving to its 'begin' position.

◆ iteratorBase() [3/3]

iteratorBase ( const HashTable< T, Key, Hash > *  curHashTable,
const hashedEntry elmt,
const label  hashIndex 
)
inlineprotected

Construct from hash table, element and hash index.

Member Function Documentation

◆ increment()

void increment ( )
inlineprotected

Increment to the next position.

Definition at line 216 of file HashTableI.H.

References HashTable::tableSize_.

◆ erase()

bool erase ( )
protected

◆ object()

T & object ( )
inlineprotected

Return non-const access to referenced object.

Definition at line 268 of file HashTableI.H.

◆ cobject()

const T & cobject ( ) const
inlineprotected

Return const access to referenced object.

Definition at line 276 of file HashTableI.H.

◆ key()

const Key & key ( ) const
inline

◆ operator==() [1/2]

bool operator== ( const iteratorBase ) const
inline

Compare hashedEntry element pointers.

◆ operator!=() [1/2]

bool operator!= ( const iteratorBase ) const
inline

◆ operator==() [2/2]

bool operator== ( const iteratorEnd &  unused) const
inline

Compare hashedEntry to iteratorEnd pointers.

◆ operator!=() [2/2]

bool operator!= ( const iteratorEnd &  unused) const
inline

Field Documentation

◆ hashTable_

HashTable<T, Key, Hash>* hashTable_
private

Pointer to the HashTable for which this is an iterator.

This also lets us use the default bitwise copy/assignment

Definition at line 349 of file HashTable.H.

Referenced by HashTable::iteratorBase::erase().

◆ entryPtr_

hashedEntry* entryPtr_
private

Current element.

Definition at line 352 of file HashTable.H.

Referenced by HashTable::iteratorBase::erase().

◆ hashIndex_

label hashIndex_
private

Current hash index.

Definition at line 355 of file HashTable.H.

Referenced by HashTable::iteratorBase::erase().


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