Go to the documentation of this file.
36 template<
class T,
unsigned N>
40 if (token::compound::isCompound(tag))
42 os << tag << token::SPACE;
50 template<
class T,
unsigned N>
62 os << token::END_STATEMENT <<
endl;
66 template<
class T,
unsigned N>
88 (
N <= unsigned(shortLen))
98 os << token::BEGIN_LIST;
101 for (
unsigned i=0; i<
N; ++i)
103 if (i) os << token::SPACE;
108 os << token::END_LIST;
113 os <<
nl << token::BEGIN_LIST <<
nl;
116 for (
unsigned i=0; i<
N; ++i)
122 os << token::END_LIST <<
nl;
130 os.
write(
reinterpret_cast<const char*
>(list.
cdata()),
N*
sizeof(
T));
140 template<
class T,
unsigned N>
147 template<
class T,
unsigned N>
154 token firstToken(is);
158 "operator>>(Istream&, FixedList<T, N>&) : "
159 "reading first token"
162 if (firstToken.isCompound())
164 list = dynamicCast<token::Compound<List<T>>>
166 firstToken.transferCompoundToken(is)
169 else if (firstToken.isLabel())
171 const label len = firstToken.labelToken();
176 else if (!firstToken.isPunctuation())
179 <<
"incorrect first token, expected <label> "
180 "or '(' or '{', found "
193 if (delimiter == token::BEGIN_LIST)
195 for (
unsigned i=0; i<
N; ++i)
201 "operator>>(Istream&, FixedList<T, N>&) : "
213 "operator>>(Istream&, FixedList<T, N>&) : "
214 "reading the single entry"
217 for (
unsigned i=0; i<
N; ++i)
230 Detail::readContiguous<T>
233 reinterpret_cast<char*
>(list.
data()),
239 "operator>>(Istream&, FixedList<T, N>&) : "
240 "reading the binary block"
A class for handling words, derived from Foam::string.
void writeEntry(Ostream &os) const
Write the FixedList with its compound type.
T * data() noexcept
Return a pointer to the first data element.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
const T * cdata() const noexcept
Return a const 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.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
Traits class for primitives.
void putBack(const token &tok)
Put back token.
A 1D vector of objects of type <T> with a fixed length <N>.
FixedList()=default
Default construct.
#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,...
const Vector< label > N(dict.get< Vector< label >>("N"))
void checkSize(const label size) const
Check size is identical to template parameter N.
A template class to specify that a data type can be considered as being contiguous in memory.