32 template<
class T,
class Key,
class Hash>
39 StaticHashTableName(),
43 endIter_(*
this, keys_.size(), 0),
44 endConstIter_(*
this, keys_.size(), 0)
50 "StaticHashTable<T, Key, Hash>::StaticHashTable(const label size)"
51 ) <<
"Illegal size " << size <<
" for StaticHashTable."
61 template<
class T,
class Key,
class Hash>
67 unsigned avgChain = 0;
72 const label count = keys_[hashIdx].size();
85 os <<
"StaticHashTable<T,Key,Hash>"
86 <<
" elements:" << size() <<
" slots:" << used <<
"/" << keys_.size()
87 <<
" chaining(avg/max):" << (used ? float(avgChain/used) : 0)
88 <<
"/" << maxChain <<
endl;
96 template<
class T,
class Key,
class Hash>
99 is.
fatalCheck(
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
104 is.
fatalCheck(
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
106 token firstToken(is);
110 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&) : "
111 "reading first token"
119 char delimiter = is.
readBeginList(
"StaticHashTable<T, Key, Hash>");
123 if (2*s > L.keys_.size())
128 if (delimiter == token::BEGIN_LIST)
130 for (label i=0; i<s; i++)
138 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&)"
147 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&)",
149 ) <<
"incorrect first token, '(', found " << firstToken.
info()
159 if (firstToken.
pToken() != token::BEGIN_LIST)
163 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&)",
165 ) <<
"incorrect first token, '(', found " << firstToken.
info()
174 && lastToken.
pToken() == token::END_LIST
190 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&) : "
201 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&)",
203 ) <<
"incorrect first token, expected <int> or '(', found "
208 is.
fatalCheck(
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
214 template<
class T,
class Key,
class Hash>
221 os <<
nl << L.size() <<
nl << token::BEGIN_LIST <<
nl;
231 os << iter.key() << token::SPACE << iter() <<
nl;
235 os << token::END_LIST;
238 os.
check(
"Ostream& operator<<(Ostream&, const StaticHashTable&)");