32 template<
class T,
class Key,
class Hash>
37 tableSize_(canonicalSize(size)),
38 table_(new hashedEntry*[tableSize_]),
39 endIter_(*this, NULL, 0),
40 endConstIter_(*this, NULL, 0)
42 for (label hashIdx = 0; hashIdx < tableSize_; hashIdx++)
53 template<
class T,
class Key,
class Hash>
59 unsigned avgChain = 0;
61 for (label hashIdx = 0; hashIdx < tableSize_; ++hashIdx)
64 for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_)
81 os <<
"HashTable<T,Key,Hash>"
82 <<
" elements:" << size() <<
" slots:" << used <<
"/" << tableSize_
83 <<
" chaining(avg/max):" << (used ? (float(avgChain)/used) : 0)
84 <<
"/" << maxChain <<
endl;
92 template<
class T,
class Key,
class Hash>
99 is.
fatalCheck(
"operator>>(Istream&, HashTable<T, Key, Hash>&)");
104 is.
fatalCheck(
"operator>>(Istream&, HashTable<T, Key, Hash>&)");
106 token firstToken(is);
110 "operator>>(Istream&, HashTable<T, Key, Hash>&) : "
111 "reading first token"
119 char delimiter = is.
readBeginList(
"HashTable<T, Key, Hash>");
123 if (2*s > L.tableSize_)
130 for (label i=0; i<s; i++)
138 "operator>>(Istream&, HashTable<T, Key, Hash>&) : "
147 "operator>>(Istream&, HashTable<T, Key, Hash>&)",
149 ) <<
"incorrect first token, '(', found " << firstToken.
info()
163 "operator>>(Istream&, HashTable<T, Key, Hash>&)",
165 ) <<
"incorrect first token, '(', found " << firstToken.
info()
186 L.insert(key, element);
190 "operator>>(Istream&, HashTable<T, Key, Hash>&) : "
201 "operator>>(Istream&, HashTable<T, Key, Hash>&)",
203 ) <<
"incorrect first token, expected <int> or '(', found "
208 is.
fatalCheck(
"operator>>(Istream&, HashTable<T, Key, Hash>&)");
214 template<
class T,
class Key,
class Hash>
239 os.
check(
"Ostream& operator<<(Ostream&, const HashTable&)");