Go to the documentation of this file.
60 template<
class T>
class List;
62 template<
class T,
class Key,
class Hash>
class HashTable;
63 template<
class T,
class Key,
class Hash>
class HashPtrTable;
65 template<
class T,
class Key,
class Hash>
68 template<
class T,
class Key,
class Hash>
118 template<
class T,
class Key=word,
class Hash=
string::hash>
172 bool set(
const Key&,
const T& newElmt,
bool protect);
183 template<
class T2,
class Key2,
class Hash2>
226 inline bool empty()
const;
229 bool found(
const Key&)
const;
252 inline bool insert(
const Key&,
const T& newElmt);
255 inline bool set(
const Key&,
const T& newElmt);
262 bool erase(
const Key&);
272 template<
class AnyType,
class AnyHash>
377 const label hashIndex
403 inline const Key&
key()
const;
410 inline bool operator==(
const iteratorEnd& unused)
const;
411 inline bool operator!=(
const iteratorEnd& unused)
const;
435 const label hashIndex
447 inline iterator(
const iteratorEnd& unused);
490 const label hashIndex
535 friend Ostream& operator<< <T, Key, Hash>
static iteratorEnd cend()
iteratorEnd set to beyond the end of any HashTable
friend class iterator
Declare friendship with the iterator.
T & operator*()
Return referenced hash value.
T & reference
Type that can be used for storing into HashTable::value_type.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
T & operator[](const Key &)
Find and return a hashedEntry.
const_iterator()
Construct null (end iterator)
void operator=(const HashTable< T, Key, Hash > &)
Assignment.
T & object()
Return non-const access to referenced object.
The iterator base for HashTable.
void resize(const label newSize)
Resize the hash table for efficiency.
void increment()
Increment to the next position.
An STL-conforming iterator.
List< Key > toc() const
Return the table of contents.
const T & operator*() const
Return referenced hash value.
void shrink()
Shrink the allocated table to approx. twice number of elements.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
const T & operator()() const
const_iterator cbegin() const
const_iterator set to the beginning of the HashTable
An STL-conforming const_iterator.
A zero-sized end iterator.
label capacity() const
The size of the underlying table.
HashTableCore()
Construct null.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iteratorBase()
Construct null - equivalent to an 'end' position.
Xfer< HashTable< T, Key, Hash > > xfer()
Transfer contents to the Xfer container.
label hashKeyIndex(const Key &) const
Return the hash index of the Key within the current table size.
HashTable(const label size=128)
Construct given initial table size.
A simple container for copying or transferring objects of type <T>.
hashedEntry * entryPtr_
Current element.
bool operator!=(const HashTable< T, Key, Hash > &) const
The opposite of the equality operation. Takes linear time.
friend class const_iterator
Declare friendship with the const_iterator.
const_iterator & operator++()
bool set(const Key &, const T &newElmt, bool protect)
Assign a new hashedEntry to a possibly already existing key.
T value_type
Type of values the HashTable contains.
hashedEntry * next_
Pointer to next hashedEntry in sub-list.
iteratorEnd()
Construct null.
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & printInfo(Ostream &) const
Print information.
bool operator!=(const iteratorBase &) const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool empty() const
Return true if the hash table is empty.
const T & cobject() const
Return const access to referenced object.
T & operator()(const Key &)
Find and return a hashedEntry, create it null if not present.
Macro definitions for declaring ClassName(), NamespaceName(), etc.
Structure to hold a hashed entry with SLList for collisions.
bool operator==(const HashTable< T, Key, Hash > &) const
Equality. Hash tables are equal if the keys and values are equal.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
hashedEntry ** table_
The table of primary entries.
friend class iteratorBase
Declare friendship with the iteratorBase.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
Template-invariant bits for HashTable.
HashTable< T, Key, Hash > * hashTable_
Pointer to the HashTable for which this is an iterator.
Ostream & operator<<(Ostream &, const edgeMesh &)
label size() const
Return number of elements in table.
bool erase()
Erase the HashTable element at the current position.
label tableSize_
Number of primary entries allocated in table.
bool found(const Key &) const
Return true if hashedEntry is found in table.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void operator=(const hashedEntry &)
Disallow default bitwise assignment.
static label canonicalSize(const label)
Return a canonical (power-of-two) size.
An STL-conforming hash table.
const Key & key() const
Return the Key corresponding to the iterator.
bool operator==(const iteratorBase &) const
Compare hashedEntry element pointers.
static const label maxTableSize
Maximum allowable table size.
iterator begin()
Iterator set to the beginning of the HashTable.
void clearStorage()
Clear the table entries and the table itself.
void clear()
Clear all entries from table.
A HashTable specialization for hashing pointers.
label nElmts_
The current number of elements in table.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
hashedEntry(const Key &, hashedEntry *next, const T &)
Construct from key, next pointer and object.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Istream & operator>>(Istream &, edgeMesh &)
static label canonicalSize(const label)
Return a canonical (power-of-two) size.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const typedef T & const_reference
Type that can be used for storing into constant.
iterator()
Construct null (end iterator)
label size_type
The type that can represent the size of a HashTable.
label hashIndex_
Current hash index.
ClassName("HashTable")
Define template name and debug.