51 #include <initializer_list>
60 template<
class T>
class List;
61 template<
class T>
class UList;
62 template<
class T,
class Key,
class Hash>
class HashTable;
63 template<
class T,
class Key,
class Hash>
class HashPtrTable;
65 template<
class Type1,
class Type2>
68 template<
class T,
class Key,
class Hash>
69 void writeEntry(Ostream& os,
const HashTable<T, Key, Hash>& ht);
71 template<
class T,
class Key,
class Hash>
74 template<
class T,
class Key,
class Hash>
124 template<
class T,
class Key=word,
class Hash=
string::hash>
144 inline hashedEntry(
const Key&, hashedEntry* next,
const T&);
147 hashedEntry(
const hashedEntry&) =
delete;
150 void operator=(
const hashedEntry&) =
delete;
163 hashedEntry** table_;
173 inline label hashKeyIndex(
const Key&)
const;
176 bool set(
const Key&,
const T& newElmt,
bool protect);
188 template<
class T2,
class Key2,
class Hash2>
238 inline bool empty()
const;
241 bool found(
const Key&)
const;
267 inline bool insert(
const Key&,
const T& newElmt);
273 inline bool set(
const Key&,
const T& newElmt);
284 bool erase(
const Key&);
294 template<
class AnyType,
class AnyHash>
378 hashedEntry* entryPtr_;
401 const hashedEntry* elmt,
402 const label hashIndex
428 inline const Key&
key()
const;
460 const label hashIndex
514 const hashedEntry* elmt,
515 const label hashIndex
560 friend Ostream& operator<< <T, Key, Hash>
A HashTable specialisation for hashing pointers.
An STL-conforming const_iterator.
const T & operator*() const
Return referenced hash value.
const_iterator & operator++()
const_iterator()
Construct null (end iterator)
const T & operator()() const
The iterator base for HashTable.
const T & cobject() const
Return const access to referenced object.
T & object()
Return non-const access to referenced object.
bool operator==(const iteratorBase &) const
Compare hashedEntry element pointers.
bool erase()
Erase the HashTable element at the current position.
bool operator!=(const iteratorBase &) const
iteratorBase()
Construct null - equivalent to an 'end' position.
const Key & key() const
Return the Key corresponding to the iterator.
void increment()
Increment to the next position.
An STL-conforming iterator.
T & operator*()
Return referenced hash value.
iterator()
Construct null (end iterator)
An STL-conforming hash table.
List< const_iterator > sorted() const
Return a sorted list of constant iterators.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
label size_type
The type that can represent the size of a HashTable.
T & operator[](const Key &)
Find and return a hashedEntry.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
void shrink()
Shrink the allocated table to approx. twice number of elements.
List< Key > toc() const
Return the table of contents.
T value_type
Type of values the HashTable contains.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
Ostream & printInfo(Ostream &) const
Print information.
iterator begin()
Iterator set to the beginning of the HashTable.
label size() const
Return number of elements in table.
const_iterator cbegin() const
const_iterator set to the beginning of the HashTable
label capacity() const
The size of the underlying table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
bool empty() const
Return true if the hash table is empty.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void clearStorage()
Clear the table entries and the table itself.
bool operator!=(const HashTable< T, Key, Hash > &) const
The opposite of the equality operation. Takes linear time.
bool found(const Key &) const
Return true if hashedEntry is found in table.
T & reference
Type that can be used for storing into HashTable::value_type.
void operator=(const HashTable< T, Key, Hash > &)
Assignment operator.
T & operator()(const Key &)
Find and return a hashedEntry, create it null if not present.
bool operator==(const HashTable< T, Key, Hash > &) const
Equality. Hash tables are equal if the keys and values are equal.
void clear()
Clear all entries from table.
HashTable(const label size=128)
Construct given initial table size.
void resize(const label newSize)
Resize the hash table for efficiency.
const T & const_reference
Type that can be used for storing into constant.
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 2-tuple for storing two objects of different types.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Macro definitions for declaring ClassName(), NamespaceName(), etc.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A zero-sized end iterator.
iteratorEnd()
Construct null.
Template-invariant bits for HashTable.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
static label canonicalSize(const label)
Return a canonical (power-of-two) size.
static iteratorEnd cend()
iteratorEnd set to beyond the end of any HashTable
static const label maxTableSize
Maximum allowable table size.
HashTableCore()
Construct null.
ClassName("HashTable")
Define template name and debug.