Go to the documentation of this file.
41 if (token::compound::isCompound(tag))
43 os << tag << token::SPACE;
50 else if (os.
format() == IOstream::ASCII)
53 os << 0 << token::BEGIN_LIST << token::END_LIST;
73 os << token::END_STATEMENT <<
endl;
86 const label len = list.
size();
94 os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
98 (len <= 1 || !shortLen)
111 os << len << token::BEGIN_LIST;
114 for (label i=0; i < len; ++i)
116 if (i) os << token::SPACE;
121 os << token::END_LIST;
126 os <<
nl << len <<
nl << token::BEGIN_LIST <<
nl;
129 for (label i=0; i < len; ++i)
135 os << token::END_LIST <<
nl;
141 os <<
nl << len <<
nl;
148 reinterpret_cast<const char*
>(list.
cdata()),
165 const label len = list.
size();
169 token firstToken(is);
171 is.
fatalCheck(
"operator>>(Istream&, UList<T>&) : reading first token");
174 if (firstToken.isCompound())
181 firstToken.transferCompoundToken(is)
185 const label inputLen = elems.size();
191 <<
"incorrect length for UList. Read "
192 << inputLen <<
" expected " << len
196 for (label i = 0; i < len; ++i)
198 list[i] = std::move(elems[i]);
206 if (firstToken.isLabel())
208 const label inputLen = firstToken.labelToken();
214 <<
"incorrect length for UList. Read "
215 << inputLen <<
" expected " << len
221 if (is.
format() == IOstream::ASCII || !is_contiguous<T>::value)
228 if (delimiter == token::BEGIN_LIST)
230 for (label i=0; i<len; ++i)
236 "operator>>(Istream&, UList<T>&) : reading entry"
249 "operator>>(Istream&, UList<T>&) : "
250 "reading the single entry"
253 for (label i=0; i<len; ++i)
267 Detail::readContiguous<T>
270 reinterpret_cast<char*
>(list.
data()),
276 "operator>>(Istream&, UList<T>&) : reading the binary block"
285 if (firstToken.isPunctuation())
287 if (firstToken.pToken() != token::BEGIN_LIST)
290 <<
"incorrect first token, expected '(', found "
300 if (sll.size() != len)
303 <<
"incorrect length for UList. Read "
304 << sll.size() <<
" expected " << len
309 for (label i = 0; i < len; ++i)
311 list[i] = std::move(sll.removeHead());
319 <<
"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.
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.
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.
bool uniform() const
True if all entries have identical values, and list is non-empty.
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.