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>
102 is.
fatalCheck(
"operator>>(Istream&, HashTable<T, Key, Hash>&)");
107 is.fatalCheck(
"operator>>(Istream&, HashTable<T, Key, Hash>&)");
109 token firstToken(is);
113 "operator>>(Istream&, HashTable<T, Key, Hash>&) : " 114 "reading first token" 122 char delimiter = is.readBeginList(
"HashTable<T, Key, Hash>");
126 if (2*s > L.tableSize_)
141 "operator>>(Istream&, HashTable<T, Key, Hash>&) : " 151 ) <<
"incorrect first token, '(', found " << firstToken.
info()
157 is.readEndList(
"HashTable");
166 ) <<
"incorrect first token, '(', found " << firstToken.
info()
179 is.putBack(lastToken);
187 L.insert(key, element);
191 "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&)");
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)
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.
label size() const
Return number of elements in table.
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))
punctuationToken pToken() const
An STL-conforming hash table.
Ostream & printInfo(Ostream &) const
Print information.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
friend Istream & operator>>(Istream &, HashTable< T, Key, Hash > &)
Template-invariant bits for HashTable.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
InfoProxy< token > info() const
Return info proxy.
bool isPunctuation() const
void fatalCheck(const char *operation) const
Check IOstream status for given operation.