Go to the documentation of this file.
30 template<
class T,
class Key,
class Hash>
46 template<
class T,
class Key,
class Hash>
51 return Hash()(key) & (tableSize_ - 1);
57 template<
class T,
class Key,
class Hash>
64 template<
class T,
class Key,
class Hash>
71 template<
class T,
class Key,
class Hash>
78 template<
class T,
class Key,
class Hash>
85 return this->set(key, newEntry,
true);
89 template<
class T,
class Key,
class Hash>
96 return this->set(key, newEntry,
false);
100 template<
class T,
class Key,
class Hash>
110 template<
class T,
class Key,
class Hash>
113 iterator iter = this->find(key);
115 if (iter == this->end())
126 template<
class T,
class Key,
class Hash>
129 const_iterator iter = this->find(key);
131 if (iter == this->cend())
142 template<
class T,
class Key,
class Hash>
145 iterator iter = this->find(key);
147 if (iter == this->end())
161 template<
class T,
class Key,
class Hash>
170 template<
class T,
class Key,
class Hash>
200 template<
class T,
class Key,
class Hash>
203 const HashTable<T, Key, Hash>* hashTbl,
204 const hashedEntry* elmt,
205 const label hashIndex
208 hashTable_(const_cast<
HashTable<
T, Key, Hash>*>(hashTbl)),
209 entryPtr_(const_cast<hashedEntry*>(elmt)),
210 hashIndex_(hashIndex)
214 template<
class T,
class Key,
class Hash>
223 hashIndex_ = -(hashIndex_+1) - 1;
227 if (entryPtr_->next_)
230 entryPtr_ = entryPtr_->next_;
245 && !(entryPtr_ = hashTable_->table_[hashIndex_])
249 if (hashIndex_ >= hashTable_->tableSize_)
258 template<
class T,
class Key,
class Hash>
262 return entryPtr_->key_;
266 template<
class T,
class Key,
class Hash>
270 return entryPtr_->obj_;
274 template<
class T,
class Key,
class Hash>
278 return entryPtr_->obj_;
282 template<
class T,
class Key,
class Hash>
288 return entryPtr_ == iter.entryPtr_;
292 template<
class T,
class Key,
class Hash>
298 return entryPtr_ != iter.entryPtr_;
302 template<
class T,
class Key,
class Hash>
312 template<
class T,
class Key,
class Hash>
324 template<
class T,
class Key,
class Hash>
331 template<
class T,
class Key,
class Hash>
341 template<
class T,
class Key,
class Hash>
351 template<
class T,
class Key,
class Hash>
354 HashTable<T, Key, Hash>* hashTbl,
356 const label hashIndex
363 template<
class T,
class Key,
class Hash>
367 return this->object();
371 template<
class T,
class Key,
class Hash>
375 return this->object();
379 template<
class T,
class Key,
class Hash>
383 return this->cobject();
387 template<
class T,
class Key,
class Hash>
391 return this->cobject();
395 template<
class T,
class Key,
class Hash>
405 template<
class T,
class Key,
class Hash>
415 template<
class T,
class Key,
class Hash>
425 template<
class T,
class Key,
class Hash>
432 template<
class T,
class Key,
class Hash>
442 template<
class T,
class Key,
class Hash>
452 template<
class T,
class Key,
class Hash>
455 const HashTable<T, Key, Hash>* hashTbl
462 template<
class T,
class Key,
class Hash>
465 const HashTable<T, Key, Hash>* hashTbl,
466 const hashedEntry* elmt,
467 const label hashIndex
474 template<
class T,
class Key,
class Hash>
478 return this->cobject();
482 template<
class T,
class Key,
class Hash>
486 return this->cobject();
490 template<
class T,
class Key,
class Hash>
500 template<
class T,
class Key,
class Hash>
510 template<
class T,
class Key,
class Hash>
518 template<
class T,
class Key,
class Hash>
friend class iterator
Declare friendship with the iterator.
T & operator*()
Return referenced hash value.
T & operator[](const Key &)
Find and return a hashedEntry.
const_iterator()
Construct null (end iterator)
T & object()
Return non-const access to referenced object.
The iterator base for HashTable.
void increment()
Increment to the next position.
An STL-conforming iterator.
const T & operator*() const
Return referenced hash value.
const T & operator()() const
const_iterator cbegin() const
const_iterator set to the beginning of the HashTable
An STL-conforming const_iterator.
label capacity() const
The size of the underlying table.
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.
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.
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.
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.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
friend class iteratorBase
Declare friendship with the iteratorBase.
HashTable< T, Key, Hash > * hashTable_
Pointer to the HashTable for which this is an iterator.
label size() const
Return number of elements in table.
label tableSize_
Number of primary entries allocated in table.
errorManipArg< error, int > exit(error &err, const int errNo=1)
An STL-conforming hash table.
const Key & key() const
Return the Key corresponding to the iterator.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
iterator begin()
Iterator set to the beginning of the HashTable.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
hashedEntry(const Key &, hashedEntry *next, const T &)
Construct from key, next pointer and object.
iterator()
Construct null (end iterator)
timeIndices insert(timeIndex, timeDirs[timeI].value())
label hashIndex_
Current hash index.