36template<
class T,
unsigned N>
58template<
class T,
unsigned N>
67template<
class T,
unsigned N>
76 os.writeKeyword(keyword);
83template<
class T,
unsigned N>
90 const FixedList<T, N>& list = *
this;
101 os.write(list.cdata_bytes(), list.size_bytes());
105 (
N <= 1 || !shortLen)
108 (
N <=
unsigned(shortLen))
119 for (
unsigned i=0; i<
N; ++i)
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;
150template<
class T,
unsigned N>
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 "
205 <<
exit(FatalIOError);
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"
A 1D vector of objects of type <T> with a fixed length <N>.
static std::streamsize size_bytes() noexcept
Number of contiguous bytes for the list data,.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
void fill(const T &val)
Assign all entries to the given value.
void checkSize(const label size) const
Check size is identical to template parameter N.
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
void writeEntry(Ostream &os) const
Write the FixedList with its compound type.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
Istream & readList(Istream &is)
Read from Istream, discarding contents of existing List.
FixedList()=default
Default construct.
streamFormat format() const noexcept
Get the current stream format.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
char readEndList(const char *funcName)
End read of list data, ends with ')' or '}'.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
void putBack(const token &tok)
Put back a token (copy). Only a single put back is permitted.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A traits class, which is primarily used for primitives and vector-space.
static bool isCompound(const word &compoundType)
True if a known (registered) compound type.
A token holds an item read from Istream.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
@ BEGIN_LIST
Begin list [isseparator].
bool isLabel() const noexcept
Integral token is convertible to Foam::label.
label labelToken() const
Return integer type as label value or Error.
compound & transferCompoundToken(const Istream *is=nullptr)
Return reference to compound and mark internally as released.
bool isCompound() const noexcept
Token is COMPOUND.
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
void readContiguous(Istream &is, char *data, std::streamsize byteCount)
Read binary block of contiguous data, possibly with conversion.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
constexpr bool is_contiguous_v
The is_contiguous value of Type (after stripping of qualifiers).
errorManipArg< error, int > exit(error &err, const int errNo=1)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
Can suppress additional line breaks separate ASCII data content when the data elements are primitives...
const Vector< label > N(dict.get< Vector< label > >("N"))