41 if (token::compound::isCompound(tag))
43 os << tag << token::SPACE;
50 else if (
os.format() == IOstreamOption::ASCII)
53 os << 0 << token::BEGIN_LIST << token::END_LIST;
70 os.writeKeyword(keyword);
73 os << token::END_STATEMENT <<
endl;
86 const label len = list.
size();
100 else if (len > 1 && is_contiguous<T>::value && list.
uniform())
103 os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
107 (len <= 1 || !shortLen)
113 is_contiguous<T>::value
114 || Detail::ListPolicy::no_linebreak<T>::value
122 os << len << token::BEGIN_LIST;
125 for (label i=0; i < len; ++i)
127 if (i)
os << token::SPACE;
132 os << token::END_LIST;
139 os <<
nl << len <<
nl << token::BEGIN_LIST <<
nl;
142 for (label i=0; i < len; ++i)
148 os << token::END_LIST <<
nl;
162 const label len = list.
size();
168 is.
fatalCheck(
"UList<T>::readList(Istream&) : reading first token");
183 const label inputLen = elems.
size();
189 <<
"incorrect length for UList. Read " 190 << inputLen <<
" expected " << len
194 for (label i = 0; i < len; ++i)
196 list[i] = std::move(elems[i]);
209 <<
"incorrect length for UList. Read " 210 << inputLen <<
" expected " << len
214 if (is.
format() == IOstreamOption::BINARY && is_contiguous<T>::value)
220 Detail::readContiguous<T>
229 "UList<T>::readList(Istream&) : " 230 "reading binary block" 237 const char delimiter = is.readBeginList(
"List");
241 if (delimiter == token::BEGIN_LIST)
243 for (label i=0; i<len; ++i)
249 "UList<T>::readList(Istream&) : " 263 "UList<T>::readList(Istream&) : " 264 "reading the single entry" 267 for (label i=0; i<len; ++i)
275 is.readEndList(
"List");
286 if (sll.size() != len)
289 <<
"incorrect length for UList. Read " 290 << sll.size() <<
" expected " << len
295 for (label i = 0; i < len; ++i)
297 list[i] = std::move(sll.removeHead());
303 <<
"incorrect first token, expected <int> or '(', found " bool isPunctuation() const noexcept
Token is PUNCTUATION.
void size(const label n)
Older name for setAddressableSize.
compound & transferCompoundToken()
Return reference to compound and mark internally as released.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool isCompound() const noexcept
Token is COMPOUND.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
A token holds an item read from Istream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives.
bool uniform() const
True if all entries have identical values, and list is non-empty.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
Istream & readList(Istream &is)
Read List contents from Istream.
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
A templated class for holding compound tokens.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
A class for handling words, derived from Foam::string.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
Type & dynamicCast(U &obj)
A dynamic_cast (for references) that generates FatalError on failed casts.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
A template class to specify that a data type can be considered as being contiguous in memory...
label labelToken() const
Return label value.
bool isLabel() const noexcept
Token is LABEL.
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
void writeEntry(Ostream &os) const
Write the UList with its compound type.
Non-intrusive singly-linked list.
streamFormat format() const noexcept
Get the current stream format.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...