37template<
class T,
class Key,
class Hash>
51 "HashPtrTable::readIstream : "
57 const label len = tok.labelToken();
60 const char delimiter = is.readBeginList(
"HashPtrTable");
64 if (2*len > this->capacity())
69 if (delimiter == token::BEGIN_LIST)
71 for (label i=0; i<len; ++i)
75 this->
set(key, inew(key, is).ptr());
79 "HashPtrTable::readIstream : "
87 <<
"incorrect first token, '(', found "
89 <<
exit(FatalIOError);
94 is.readEndList(
"HashPtrTable");
96 else if (tok.isPunctuation(token::BEGIN_LIST))
100 while (!tok.isPunctuation(token::END_LIST))
105 this->set(key, inew(key, is).ptr());
109 "HashPtrTable::readIstream : "
119 <<
"incorrect first token, expected <int> or '(', found "
121 << exit(FatalIOError);
128template<
class T,
class Key,
class Hash>
132 const dictionary&
dict,
136 for (
const entry&
e :
dict)
138 this->
set(
e.keyword(), inew(
e.dict()).ptr());
143template<
class T,
class Key,
class Hash>
146 for (
const_iterator iter = this->cbegin(); iter != this->cend(); ++iter)
148 const T* ptr = iter.val();
159template<
class T,
class Key,
class Hash>
163 this->readIstream(is, inew);
167template<
class T,
class Key,
class Hash>
170 this->readIstream(is,
INew<T>());
174template<
class T,
class Key,
class Hash>
183template<
class T,
class Key,
class Hash>
187 tbl.readIstream(is,
INew<T>());
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
HashPtrTable()=default
Default construct with default table capacity.
typename parent_type::const_iterator const_iterator
void clear()
Clear all entries from table and delete any allocated pointers.
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,...
virtual bool read()
Re-read model coefficients if they have changed.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool write()
Write the output fields.
patchWriters resize(patchIds.size())
#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').
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Istream & operator>>(Istream &, directionInfo &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)