39 if (token::compound::isCompound(tag))
41 os << tag << token::SPACE;
50 os.format() == IOstreamOption::BINARY
51 || std::is_same_v<char, std::remove_cv_t<T>>
61 os << label(0) << token::BEGIN_LIST << token::END_LIST;
73 os.writeKeyword(keyword);
89 const label len = list.
size();
91 if (
os.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
103 else if constexpr (std::is_same_v<
char, std::remove_cv_t<T>>)
107 const auto oldFmt =
os.format(IOstreamOption::BINARY);
118 else if (is_contiguous_v<T> && len > 1 && list.
uniform())
121 os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
125 (len <= 1 || !shortLen)
136 os << len << token::BEGIN_LIST;
138 auto iter = list.
cbegin();
139 const auto last = list.
cend();
146 for (++iter; (iter != last); (void)++iter)
148 os << token::SPACE << *iter;
153 os << token::END_LIST;
160 os <<
nl << len <<
nl << token::BEGIN_LIST;
162 auto iter = list.
cbegin();
163 const auto last = list.
cend();
166 for (; (iter != last); (void)++iter)
172 os <<
nl << token::END_LIST <<
nl;
186 const label len = list.
size();
192 is.
fatalCheck(
"UList<T>::readList(Istream&) : reading first token");
204 const label inputLen = elems.
size();
210 <<
"incorrect length for UList. Read " 211 << inputLen <<
" expected " << len
227 <<
"incorrect length for UList. Read " 228 << inputLen <<
" expected " << len
232 if (is.
format() == IOstreamOption::BINARY && is_contiguous_v<T>)
238 Detail::readContiguous<T>
247 "UList<T>::readList(Istream&) : " 248 "reading binary block" 252 else if constexpr (std::is_same_v<
char, std::remove_cv_t<T>>)
255 const auto oldFmt = is.format(IOstreamOption::BINARY);
264 "UList<char>::readList(Istream&) : " 265 "reading binary block" 274 const char delimiter = is.readBeginList(
"List");
278 if (delimiter == token::BEGIN_LIST)
280 for (label i=0; i<len; ++i)
286 "UList<T>::readList(Istream&) : " 300 "UList<T>::readList(Istream&) : " 301 "reading the single entry" 305 this->fill_uniform(elem);
310 is.readEndList(
"List");
322 while (!tok.isPunctuation(token::END_LIST))
327 is >> list[inputLen];
339 "UList<T>::readList(Istream&) : " 351 <<
"incorrect length for UList. Read " 352 << inputLen <<
" expected " << len
359 <<
"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.
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.
Can suppress additional line breaks separate ASCII data content when the data elements are primitives...
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...