32 template<
class T,
class Key,
class Hash>
42 table_ =
new hashedEntry*[tableSize_];
44 for (
label hashIdx = 0; hashIdx < tableSize_; hashIdx++)
56 template<
class T,
class Key,
class Hash>
62 unsigned avgChain = 0;
64 for (
label hashIdx = 0; hashIdx < tableSize_; ++hashIdx)
67 for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_)
84 os <<
"HashTable<T,Key,Hash>" 85 <<
" elements:" << size() <<
" slots:" << used <<
"/" << tableSize_
86 <<
" chaining(avg/max):" << (used ? (float(avgChain)/used) : 0)
87 <<
"/" << maxChain <<
endl;
95 template<
class T,
class Key,
class Hash>
104 template<
class T,
class Key,
class Hash>
111 is.
fatalCheck(
"operator>>(Istream&, HashTable<T, Key, Hash>&)");
116 is.fatalCheck(
"operator>>(Istream&, HashTable<T, Key, Hash>&)");
118 token firstToken(is);
122 "operator>>(Istream&, HashTable<T, Key, Hash>&) : " 123 "reading first token" 131 char delimiter = is.readBeginList(
"HashTable<T, Key, Hash>");
135 if (2*s > L.tableSize_)
140 if (delimiter == token::BEGIN_LIST)
150 "operator>>(Istream&, HashTable<T, Key, Hash>&) : " 160 ) <<
"incorrect first token, '(', found " << firstToken.
info()
166 is.readEndList(
"HashTable");
170 if (firstToken.
pToken() != token::BEGIN_LIST)
175 ) <<
"incorrect first token, '(', found " << firstToken.
info()
184 && lastToken.
pToken() == token::END_LIST
188 is.putBack(lastToken);
196 L.insert(key, element);
200 "operator>>(Istream&, HashTable<T, Key, Hash>&) : " 212 ) <<
"incorrect first token, expected <int> or '(', found " 217 is.fatalCheck(
"operator>>(Istream&, HashTable<T, Key, Hash>&)");
223 template<
class T,
class Key,
class Hash>
231 os <<
nl << L.size() <<
nl << token::BEGIN_LIST <<
nl;
241 os << iter.key() << token::SPACE << iter() <<
nl;
245 os << token::END_LIST;
248 os.check(
"Ostream& operator<<(Ostream&, const HashTable&)");
punctuationToken pToken() const
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
An STL-conforming const_iterator.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & printInfo(Ostream &) const
Print information.
InfoProxy< token > info() const
Return info proxy.
HashTable(const label size=128)
Construct given initial table size.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds items read from Istream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Istream & operator>>(Istream &, directionInfo &)
An STL-conforming hash table.
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Template-invariant bits for HashTable.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
bool isPunctuation() const