Go to the documentation of this file.
33 template<
unsigned W
idth>
42 template<
unsigned W
idth>
49 os << token::BEGIN_LIST <<
nl;
51 const label nblocks = debugOutput ? blocks_.size() : num_blocks(size());
52 for (label blocki = 0; blocki < nblocks; ++blocki)
57 os << token::END_LIST <<
nl;
63 template<
unsigned W
idth>
74 "PackedList::read(Istream&) : "
86 if (is.
format() == IOstream::ASCII)
93 if (delimiter == token::BEGIN_LIST)
95 for (label i=0; i<len; ++i)
101 "PackedList::read(Istream&) : "
113 "PackedList::read(Istream&) : "
114 "reading the single entry"
130 reinterpret_cast<char*
>(list.
storage().data()),
136 "PackedList::read(Istream&) : "
137 "reading the binary block"
144 if (firstTok.
pToken() == token::BEGIN_LIST)
152 && nextTok.
pToken() == token::END_LIST
163 else if (firstTok.
pToken() == token::BEGIN_BLOCK)
171 && nextTok.
pToken() == token::END_BLOCK
185 <<
"incorrect first token, expected '(', found "
193 <<
"incorrect first token, expected <int>, '(' or '{', found "
202 template<
unsigned W
idth>
210 const label len = list.
size();
213 if (os.
format() == IOstream::ASCII)
218 os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
220 else if (!shortLen || len <= shortLen)
223 os << len << token::BEGIN_LIST;
224 for (label i=0; i < len; ++i)
226 if (i) os << token::SPACE;
229 os << token::END_LIST;
234 os <<
nl << len <<
nl << token::BEGIN_LIST <<
nl;
235 for (label i=0; i < len; ++i)
239 os << token::END_LIST <<
nl;
245 os <<
nl << len <<
nl;
252 reinterpret_cast<const char*
>(list.
storage().cdata()),
262 template<
unsigned W
idth>
274 os << token::END_STATEMENT <<
endl;
280 template<
unsigned W
idth>
283 return list.
read(is);
287 template<
unsigned W
idth>
291 const InfoProxy<PackedList<Width>>& iproxy
294 const PackedList<Width>& list = iproxy.t_;
296 os <<
"PackedList<" << Width
297 <<
"> size=" << list.
size() <<
"/" << list.capacity()
298 <<
" (limits: max=" << PackedList<Width>::max_value
299 <<
", elem_per_block=" << PackedList<Width>::elem_per_block
label labelToken() const
Return label value.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
bool isLabel() const noexcept
Token is LABEL.
A class for handling words, derived from Foam::string.
Istream & read(Istream &is)
Clear list and read from stream.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
streamFormat format() const noexcept
Get the current stream format.
char readEndList(const char *funcName)
End read of list data, ends with ')' or '}'.
Istream & operator>>(Istream &, directionInfo &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds an item read from Istream.
void resize(const label nElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
punctuationToken pToken() const
Return punctuation character.
bool uniform() const
True if all entries have identical values, and list is non-empty.
Ostream & printBits(Ostream &os, bool debugOutput=false) const
Print bit patterns, optionally with extra debug.
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool isPunctuation() const noexcept
Token is PUNCTUATION.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
std::streamsize byteSize() const
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual Ostream & writeKeyword(const keyType &kw)
Write the keyword followed by an appropriate indentation.
PackedList< Width > & append(const unsigned int val)
Append a value at the end of the list.
void setPair(Istream &is)
Read an index/value pair and set accordingly.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void writeEntry(Ostream &os) const
Write as a dictionary entry.
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
void putBack(const token &tok)
Put back token.
label size() const noexcept
Number of entries.
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
const List< unsigned int > & storage() const
Return the underlying storage blocks.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void clear()
Clear the list, i.e. set addressable size to zero.
static unsigned int readValue(Istream &is)
Read a list entry (allows for specialization)
virtual Istream & read(token &)=0
Return next token from stream.