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 return set(key, newEntry,
true);
82 template<
class T,
class Key,
class Hash>
89 return set(key, newEntry,
false);
93 template<
class T,
class Key,
class Hash>
103 template<
class T,
class Key,
class Hash>
110 FatalErrorIn(
"HashTable<T, Key, Hash>::operator[](const Key&)")
111 << key <<
" not found in table. Valid entries: "
120 template<
class T,
class Key,
class Hash>
127 FatalErrorIn(
"HashTable<T, Key, Hash>::operator[](const Key&) const")
128 << key <<
" not found in table. Valid entries: "
137 template<
class T,
class Key,
class Hash>
156 template<
class T,
class Key,
class Hash>
166 hashIndex_(hashIndex)
170 template<
class T,
class Key,
class Hash>
176 elmtPtr_ = iter.elmtPtr_;
177 hashIndex_ = iter.hashIndex_;
181 template<
class T,
class Key,
class Hash>
182 inline bool Foam::HashTable<T, Key, Hash>::iterator::operator==
187 return elmtPtr_ == iter.elmtPtr_;
191 template<
class T,
class Key,
class Hash>
192 inline bool Foam::HashTable<T, Key, Hash>::iterator::operator!=
197 return elmtPtr_ != iter.elmtPtr_;
201 template<
class T,
class Key,
class Hash>
202 inline bool Foam::HashTable<T, Key, Hash>::iterator::operator==
207 return elmtPtr_ == iter.elmtPtr_;
211 template<
class T,
class Key,
class Hash>
212 inline bool Foam::HashTable<T, Key, Hash>::iterator::operator!=
217 return elmtPtr_ != iter.elmtPtr_;
221 template<
class T,
class Key,
class Hash>
225 return elmtPtr_->obj_;
229 template<
class T,
class Key,
class Hash>
233 return elmtPtr_->obj_;
237 template<
class T,
class Key,
class Hash>
241 return elmtPtr_->obj_;
245 template<
class T,
class Key,
class Hash>
249 return elmtPtr_->obj_;
253 template<
class T,
class Key,
class Hash>
262 if (elmtPtr_ && elmtPtr_->next_)
264 elmtPtr_ = elmtPtr_->next_;
272 ++hashIndex_ < hashTable_.tableSize_
273 && !(elmtPtr_ = hashTable_.table_[hashIndex_])
277 if (hashIndex_ == hashTable_.tableSize_)
287 template<
class T,
class Key,
class Hash>
289 Foam::HashTable<T, Key, Hash>::iterator::operator++
300 template<
class T,
class Key,
class Hash>
304 return elmtPtr_->key_;
308 template<
class T,
class Key,
class Hash>
316 while (table_ && !table_[i] && ++i < tableSize_)
329 Info<<
"HashTable is empty\n";
337 return iterator(*
this, table_[i], i);
342 template<
class T,
class Key,
class Hash>
352 template<
class T,
class Key,
class Hash>
356 const hashedEntry* elmt,
362 hashIndex_(hashIndex)
366 template<
class T,
class Key,
class Hash>
372 hashTable_(iter.hashTable_),
373 elmtPtr_(iter.elmtPtr_),
374 hashIndex_(iter.hashIndex_)
378 template<
class T,
class Key,
class Hash>
384 elmtPtr_ = iter.elmtPtr_;
385 hashIndex_ = iter.hashIndex_;
389 template<
class T,
class Key,
class Hash>
390 inline bool Foam::HashTable<T, Key, Hash>::const_iterator::operator==
395 return elmtPtr_ == iter.elmtPtr_;
399 template<
class T,
class Key,
class Hash>
400 inline bool Foam::HashTable<T, Key, Hash>::const_iterator::operator!=
405 return elmtPtr_ != iter.elmtPtr_;
409 template<
class T,
class Key,
class Hash>
410 inline bool Foam::HashTable<T, Key, Hash>::const_iterator::operator==
415 return elmtPtr_ == iter.elmtPtr_;
419 template<
class T,
class Key,
class Hash>
420 inline bool Foam::HashTable<T, Key, Hash>::const_iterator::operator!=
425 return elmtPtr_ != iter.elmtPtr_;
429 template<
class T,
class Key,
class Hash>
433 return elmtPtr_->obj_;
436 template<
class T,
class Key,
class Hash>
440 return elmtPtr_->obj_;
444 template<
class T,
class Key,
class Hash>
451 !(elmtPtr_ = elmtPtr_->next_)
452 && ++hashIndex_ < hashTable_.tableSize_
453 && !(elmtPtr_ = hashTable_.table_[hashIndex_])
458 ++hashIndex_ < hashTable_.tableSize_
459 && !(elmtPtr_ = hashTable_.table_[hashIndex_])
468 template<
class T,
class Key,
class Hash>
470 Foam::HashTable<T, Key, Hash>::const_iterator::operator++
481 template<
class T,
class Key,
class Hash>
485 return elmtPtr_->key_;
489 template<
class T,
class Key,
class Hash>
497 while (table_ && !table_[i] && ++i < tableSize_)
510 Info<<
"HashTable is empty\n";
523 template<
class T,
class Key,
class Hash>
531 template<
class T,
class Key,
class Hash>
539 template<
class T,
class Key,
class Hash>