Go to the documentation of this file.
43 if (token::compound::isCompound(tag))
45 os << tag << token::SPACE;
49 else if (os.
format() == IOstream::ASCII)
52 os << 0 << token::BEGIN_LIST << token::END_LIST;
72 os << token::END_STATEMENT <<
endl;
93 os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
97 (len <= 1 || !shortLen)
110 os << len << token::BEGIN_LIST;
113 for (
label i=0; i < len; ++i)
115 if (i) os << token::SPACE;
120 os << token::END_LIST;
125 os <<
nl << len <<
nl << token::BEGIN_LIST <<
nl;
128 for (
label i=0; i < len; ++i)
134 os << token::END_LIST <<
nl;
140 os <<
nl << len <<
nl;
147 reinterpret_cast<const char*
>(list.
cdata()),
168 token firstToken(is);
170 is.
fatalCheck(
"operator>>(Istream&, UList<T>&) : reading first token");
173 if (firstToken.isCompound())
180 firstToken.transferCompoundToken(is)
184 const label inputLen = elems.size();
190 <<
"incorrect length for UList. Read "
191 << inputLen <<
" expected " << len
195 for (
label i = 0; i < len; ++i)
197 list[i] = std::move(elems[i]);
205 if (firstToken.isLabel())
207 const label inputLen = firstToken.labelToken();
213 <<
"incorrect length for UList. Read "
214 << inputLen <<
" expected " << len
220 if (is.
format() == IOstream::ASCII || !is_contiguous<T>::value)
227 if (delimiter == token::BEGIN_LIST)
229 for (
label i=0; i<len; ++i)
235 "operator>>(Istream&, UList<T>&) : reading entry"
248 "operator>>(Istream&, UList<T>&) : "
249 "reading the single entry"
252 for (
label i=0; i<len; ++i)
266 Detail::readContiguous<T>
269 reinterpret_cast<char*
>(list.
data()),
275 "operator>>(Istream&, UList<T>&) : reading the binary block"
284 if (firstToken.isPunctuation())
286 if (firstToken.pToken() != token::BEGIN_LIST)
289 <<
"incorrect first token, expected '(', found "
299 if (sll.size() != len)
302 <<
"incorrect length for UList. Read "
303 << sll.size() <<
" expected " << len
308 for (
label i = 0; i < len; ++i)
310 list[i] = std::move(sll.removeHead());
318 <<
"incorrect first token, expected <int> or '(', found "
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
A class for handling words, derived from Foam::string.
A templated class for holding compound tokens.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
T * data()
Return a pointer to the first data element.
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.
bool uniform() const
True if all entries have identical values, and list is non-empty.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void transfer(List< T > &list)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
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.
void writeEntry(Ostream &os) const
Write the UList with its compound type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Non-intrusive singly-linked list.
To & dynamicCast(From &r)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Traits class for primitives.
void putBack(const token &tok)
Put back token.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
std::streamsize byteSize() const
const T * cdata() const
Return a const pointer to the first data element.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
#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,...
A template class to specify that a data type can be considered as being contiguous in memory.