36 template<
class T,
unsigned N>
40 if (token::compound::isCompound(tag))
42 os << tag << token::SPACE;
43 if constexpr (is_contiguous_v<T>)
45 if (
os.format() == IOstreamOption::BINARY)
48 os << static_cast<label>(
N);
58 template<
class T,
unsigned N>
67 template<
class T,
unsigned N>
76 os.writeKeyword(keyword);
83 template<
class T,
unsigned N>
96 if (
os.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
105 (
N <= 1 || !shortLen)
108 (
N <= unsigned(shortLen))
116 os << token::BEGIN_LIST;
119 for (
unsigned i=0; i<
N; ++i)
121 if (i)
os << token::SPACE;
126 os << token::END_LIST;
133 os <<
nl << token::BEGIN_LIST <<
nl;
136 for (
unsigned i=0; i<
N; ++i)
142 os << token::END_LIST <<
nl;
150 template<
class T,
unsigned N>
160 if (is.
format() == IOstreamOption::BINARY && is_contiguous_v<T>)
164 Detail::readContiguous<T>
173 "FixedList<T, N>::readList(Istream&) : " 174 "reading the binary block" 184 "FixedList<T, N>::readList(Istream&) : " 185 "reading first token" 188 if (tok.isCompound())
192 list = tok.transferCompoundToken<List<T>>(is);
195 else if (tok.isLabel())
200 else if (!tok.isPunctuation())
203 <<
"incorrect first token, expected <label> or '(' , found " 216 if (delimiter == token::BEGIN_LIST)
218 for (
unsigned i=0; i<
N; ++i)
224 "FixedList<T, N>::readList(Istream&) : " 239 "FixedList<T, N>::readList(Istream&) : " 240 "reading the single entry" const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A 1D vector of objects of type <T> with a fixed length <N>.
char readEndList(const char *funcName)
End read of list data, ends with ')' or '}'.
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 traits class, which is primarily used for primitives and vector-space.
void writeEntry(Ostream &os) const
Write the FixedList with its compound type.
void putBack(const token &tok)
Put back a token (copy). Only a single put back is permitted.
A class for handling words, derived from Foam::string.
static std::streamsize size_bytes() noexcept
Number of contiguous bytes for the list data,.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void checkSize(const label size) const
Check size is identical to template parameter N.
OBJstream os(runTime.globalPath()/outputName)
const Vector< label > N(dict.get< Vector< label >>("N"))
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Istream & readList(Istream &is)
Read from Istream, discarding contents of existing List.
streamFormat format() const noexcept
Get the current stream format.
Can suppress additional line breaks separate ASCII data content when the data elements are primitives...
FixedList()=default
Default construct.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...