37template<
class T,
class Key,
class Hash>
39void Foam::HashPtrTable<T, Key, Hash>::readIstream
51 "HashPtrTable::readIstream : "
57 const label len = tok.labelToken();
60 const char delimiter = is.readBeginList(
"HashPtrTable");
64 this->
reserve(this->size() + len);
66 if (delimiter == token::BEGIN_LIST)
68 for (label i=0; i<len; ++i)
72 this->
set(key, inew(key, is).ptr());
76 "HashPtrTable::readIstream : "
84 <<
"incorrect first token, '(', found "
86 <<
exit(FatalIOError);
91 is.readEndList(
"HashPtrTable");
93 else if (tok.isPunctuation(token::BEGIN_LIST))
97 while (!tok.isPunctuation(token::END_LIST))
102 this->
set(key, inew(key, is).ptr());
106 "HashPtrTable::readIstream : "
116 <<
"incorrect first token, expected <int> or '(', found "
118 <<
exit(FatalIOError);
125template<
class T,
class Key,
class Hash>
127void Foam::HashPtrTable<T, Key, Hash>::read
134 for (
const entry&
e :
dict)
136 this->
set(
e.keyword(), inew(
e.dict()).ptr());
141template<
class T,
class Key,
class Hash>
144 for (const_iterator iter = this->cbegin(); iter != this->cend(); ++iter)
146 const T* ptr = iter.val();
157template<
class T,
class Key,
class Hash>
161 this->readIstream(is, inew);
165template<
class T,
class Key,
class Hash>
168 this->readIstream(is,
INew<T>());
172template<
class T,
class Key,
class Hash>
181template<
class T,
class Key,
class Hash>
185 tbl.readIstream(is, INew<T>());
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
constexpr HashPtrTable() noexcept=default
Default construct: empty without allocation (capacity=0).
void write(Ostream &os) const
Invoke write() on each non-null entry.
bool set(const Key &key, T *ptr)
Assign a new entry, overwrites existing.
typename parent_type::const_iterator const_iterator
void clear()
Clear all entries from table and delete any allocated pointers.
const_iterator cbegin() const
const_iterator set to the beginning of the HashTable
constexpr const_iterator cend() const noexcept
const_iterator to signal the end (for any HashTable)
A helper class when constructing from an Istream or dictionary.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
bool read(const char *buf, int32_t &val)
Same as readInt32.
Istream & operator>>(Istream &, directionInfo &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
triangles reserve(surf.size())