40 if (token::compound::isCompound(tag))
42 os << tag << token::SPACE;
51 os.format() == IOstreamOption::BINARY
62 os << label(0) << token::BEGIN_LIST << token::END_LIST;
74 os.writeKeyword(keyword);
90 const label len = list.
size();
108 const auto oldFmt =
os.format(IOstreamOption::BINARY);
119 else if (is_contiguous<T>::value && len > 1 && list.
uniform())
122 os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
126 (len <= 1 || !shortLen)
132 is_contiguous<T>::value
133 || Detail::ListPolicy::no_linebreak<T>::value
141 os << len << token::BEGIN_LIST;
143 auto iter = list.
cbegin();
144 const auto last = list.
cend();
151 for (++iter; (iter != last); (void)++iter)
153 os << token::SPACE << *iter;
158 os << token::END_LIST;
165 os <<
nl << len <<
nl << token::BEGIN_LIST;
167 auto iter = list.
cbegin();
168 const auto last = list.
cend();
171 for (; (iter != last); (void)++iter)
177 os <<
nl << token::END_LIST <<
nl;
191 const label len = list.
size();
197 is.
fatalCheck(
"UList<T>::readList(Istream&) : reading first token");
209 const label inputLen = elems.
size();
215 <<
"incorrect length for UList. Read " 216 << inputLen <<
" expected " << len
232 <<
"incorrect length for UList. Read " 233 << inputLen <<
" expected " << len
237 if (is.
format() == IOstreamOption::BINARY && is_contiguous<T>::value)
243 Detail::readContiguous<T>
252 "UList<T>::readList(Istream&) : " 253 "reading binary block" 260 const auto oldFmt = is.format(IOstreamOption::BINARY);
269 "UList<char>::readList(Istream&) : " 270 "reading binary block" 279 const char delimiter = is.readBeginList(
"List");
283 if (delimiter == token::BEGIN_LIST)
285 for (label i=0; i<len; ++i)
291 "UList<T>::readList(Istream&) : " 305 "UList<T>::readList(Istream&) : " 306 "reading the single entry" 310 this->fill_uniform(elem);
315 is.readEndList(
"List");
327 while (!tok.isPunctuation(token::END_LIST))
332 is >> list[inputLen];
344 "UList<T>::readList(Istream&) : " 356 <<
"incorrect length for UList. Read " 357 << inputLen <<
" expected " << len
364 <<
"incorrect first token, expected <int> or '(', found " bool isPunctuation() const noexcept
Token is PUNCTUATION.
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant UList.
void size(const label n)
Older name for setAddressableSize.
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.
A traits class, which is primarily used for primitives and vector-space.
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,.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
compound & transferCompoundToken(const Istream *is=nullptr)
Return reference to compound and mark internally as released.
A class for handling words, derived from Foam::string.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
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)
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.
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant UList.
void writeEntry(Ostream &os) const
Write the UList with its compound type.
iterator end() noexcept
Return an iterator to end traversing the UList.
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 ...