33template<
class T,
class Key,
class Hash>
35Foam::HashTable<T, Key, Hash>::hashKeyIndex(
const Key& key)
const
38 return Hash()(key) & (capacity_ - 1);
44template<
class T,
class Key,
class Hash>
52 << key <<
" not found in table. Valid entries: "
61template<
class T,
class Key,
class Hash>
64 const const_iterator iter(this->cfind(key));
69 << key <<
" not found in table. Valid entries: "
78template<
class T,
class Key,
class Hash>
83 return Iterator<true>(
this, key).good();
90template<
class T,
class Key,
class Hash>
99 return iterator(Iterator<false>(
this, key));
106template<
class T,
class Key,
class Hash>
113 return this->
cfind(key);
117template<
class T,
class Key,
class Hash>
133template<
class T,
class Key,
class Hash>
134template<
class... Args>
141 return this->setEntry(
false, key, std::forward<Args>(
args)...);
145template<
class T,
class Key,
class Hash>
146template<
class... Args>
153 return this->setEntry(
true, key, std::forward<Args>(
args)...);
157template<
class T,
class Key,
class Hash>
164 return this->setEntry(
false, key, obj);
168template<
class T,
class Key,
class Hash>
175 return this->setEntry(
false, key, std::forward<T>(obj));
179template<
class T,
class Key,
class Hash>
186 return this->setEntry(
true, key, obj);
190template<
class T,
class Key,
class Hash>
197 return this->setEntry(
true, key, std::forward<T>(obj));
227template<
class T,
class Key,
class Hash>
241template<
class T,
class Key,
class Hash>
244 return this->
at(key);
248template<
class T,
class Key,
class Hash>
251 return this->
at(key);
255template<
class T,
class Key,
class Hash>
266 return find(key).val();
270template<
class T,
class Key,
class Hash>
285 return find(key).val();
Internally used base for iterator and const_iterator.
bool good() const noexcept
True if iterator points to an entry.
Forward iterator with const access.
reference val() const
Const access to referenced object (value).
Forward iterator with non-const access.
const_reference val() const
Const access to referenced object (value).
T & operator()(const Key &key)
Return existing entry or create a new entry.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
bool set(const Key &key, const T &obj)
Copy assign a new entry, overwriting existing entries.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
bool contains(const Key &key) const
True if hashed key is contained (found) in table.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
bool emplace_set(const Key &key, Args &&... args)
Emplace set an entry, overwriting any existing entries.
friend Ostream & operator(Ostream &, const HashTable< T, Key, Hash > &tbl)
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
bool emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
T & at(const Key &key)
Find and return a hashed entry. FatalError if it does not exist.
T & operator[](const Key &key)
Find and return a hashed entry. FatalError if it does not exist.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Foam::argList args(argc, argv)
nonInt insert("surfaceSum(((S|magSf)*S)")
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...