34 template<
class T,
unsigned Size>
41 template<
class T,
unsigned Size>
44 is.
fatalCheck(
"operator>>(Istream&, FixedList<T, Size>&)");
46 if (is.
format() == IOstream::ASCII || !contiguous<T>())
52 "operator>>(Istream&, FixedList<T, Size>&) : reading first token" 57 L = dynamicCast<token::Compound<List<T>>>
72 <<
"incorrect first token, expected <label> " 73 "or '(' or '{', found " 86 if (delimiter == token::BEGIN_LIST)
88 for (
unsigned i=0; i<Size; i++)
94 "operator>>(Istream&, FixedList<T, Size>&) : " 106 "operator>>(Istream&, FixedList<T, Size>&) : " 107 "reading the single entry" 110 for (
unsigned i=0; i<Size; i++)
121 is.
read(reinterpret_cast<char*>(L.
data()), Size*
sizeof(
T));
125 "operator>>(Istream&, FixedList<T, Size>&) : " 126 "reading the binary block" 136 template<
class T,
unsigned Size>
151 template<
class T,
unsigned Size>
160 os << token::END_STATEMENT <<
endl;
164 template<
class T,
unsigned Size>
165 Foam::Ostream& Foam::operator<<(Ostream& os, const FixedList<T, Size>& L)
168 if (os.
format() == IOstream::ASCII || !contiguous<T>())
172 if (Size > 1 && contiguous<T>())
189 os << L.
size() << token::BEGIN_BLOCK;
195 os << token::END_BLOCK;
197 else if (Size <= 1 ||(Size < 11 && contiguous<T>()))
200 os << token::BEGIN_LIST;
205 if (i > 0) os << token::SPACE;
210 os << token::END_LIST;
215 os <<
nl << token::BEGIN_LIST;
224 os <<
nl << token::END_LIST <<
nl;
229 os.
write(reinterpret_cast<const char*>(L.
cdata()), Size*
sizeof(
T));
233 os.
check(
"Ostream& operator<<(Ostream&, const FixedList&)");
#define forAll(list, i)
Loop across all elements in list.
void writeEntry(Ostream &) const
Write the FixedList as a dictionary entry.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
compound & transferCompoundToken(const Istream &is)
errorManipArg< error, int > exit(error &err, const int errNo=1)
A 1D vector of objects of type <T> with a fixed size <Size>.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
char readEndList(const char *funcName)
InfoProxy< token > info() const
Return info proxy.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds items read from Istream.
void putBack(const token &)
Put back token.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Template function to specify if the data of a type are contiguous.
Traits class for primitives.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual Istream & read(token &)=0
Return next token from stream.
A class for handling words, derived from string.
Istream & operator>>(Istream &, directionInfo &)
streamFormat format() const
Return current stream format.
char readBeginList(const char *funcName)
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void checkSize(const label size) const
Check size is within valid range (0 ... size)
label size() const
Return the number of elements in the FixedList.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
FixedList()
Null constructor.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
T * data()
Return a pointer to the first data element,.
virtual Ostream & write(const token &)=0
Write next token to stream.
bool isPunctuation() const
const T * cdata() const
Return a const pointer to the first data element,.