HashList< Type, Key, Hash > Class Template Reference

HashList class. Like HashTable, but much less dynamic memory-y. Should be faster for small sets of non-dynamic primitive types (labels, edges, points, etc...). It is also much less functional at present. There is no re-sizing, so you have to make sure it is constructed sufficiently large to hold all the data that will ever be inserted into it. More...

Inheritance diagram for HashList< Type, Key, Hash >:
Collaboration diagram for HashList< Type, Key, Hash >:

Public Member Functions

 HashList (const label size)
 Construct given a size. More...
 
label capacity () const
 The size of the underlying list. More...
 
void clear ()
 Clear all elements. More...
 
void resizeAndClear (const label newSize)
 Resize and clear all elements. More...
 
bool insert (const Key &k, const Type &t)
 Insert into the hash list. Return true if the value was newly. More...
 
const Type & operator[] (const Key &k) const
 Retrieve from the hash list. More...
 
const edge nullKey (-labelMax, -labelMax)
 

Static Public Attributes

static const Key nullKey = Key::null
 Null key value for unset elements in the list. More...
 

Detailed Description

template<class Type, class Key = word, class Hash = string::hash>
class Foam::HashList< Type, Key, Hash >

HashList class. Like HashTable, but much less dynamic memory-y. Should be faster for small sets of non-dynamic primitive types (labels, edges, points, etc...). It is also much less functional at present. There is no re-sizing, so you have to make sure it is constructed sufficiently large to hold all the data that will ever be inserted into it.

Source files

Definition at line 57 of file HashList.H.

Constructor & Destructor Documentation

◆ HashList()

HashList ( const label  size)

Construct given a size.

Definition at line 40 of file HashList.C.

Member Function Documentation

◆ capacity()

Foam::label capacity
inline

The size of the underlying list.

Definition at line 49 of file HashList.C.

◆ clear()

void clear

Clear all elements.

Definition at line 56 of file HashList.C.

◆ resizeAndClear()

void resizeAndClear ( const label  newSize)

Resize and clear all elements.

Definition at line 66 of file HashList.C.

References clear(), and resize().

Here is the call graph for this function:

◆ insert()

bool insert ( const Key &  k,
const Type &  t 
)

Insert into the hash list. Return true if the value was newly.

inserted, or false if it was already there.

Definition at line 75 of file HashList.C.

◆ operator[]()

const Type & operator[] ( const Key &  k) const

Retrieve from the hash list.

Definition at line 110 of file HashList.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::first(), Foam::constant::universal::h, k, n, and List< T >::size().

Here is the call graph for this function:

◆ nullKey()

const edge nullKey ( labelMax,
labelMax 
)

Member Data Documentation

◆ nullKey

const Key nullKey = Key::null
static

Null key value for unset elements in the list.

Definition at line 66 of file HashList.H.


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