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>
142 && token::compound::isCompound
155 template<
class T,
unsigned Size>
164 os << token::END_STATEMENT <<
endl;
168 template<
class T,
unsigned Size>
169 Foam::Ostream& Foam::operator<<(Ostream& os, const FixedList<T, Size>& L)
172 if (os.
format() == IOstream::ASCII || !contiguous<T>())
176 if (Size > 1 && contiguous<T>())
193 os << L.
size() << token::BEGIN_BLOCK;
199 os << token::END_BLOCK;
201 else if (Size <= 1 ||(Size < 11 && contiguous<T>()))
204 os << token::BEGIN_LIST;
209 if (i > 0) os << token::SPACE;
214 os << token::END_LIST;
219 os <<
nl << token::BEGIN_LIST;
228 os <<
nl << token::END_LIST <<
nl;
233 os.
write(reinterpret_cast<const char*>(L.
cdata()), Size*
sizeof(
T));
237 os.
check(
"Ostream& operator<<(Ostream&, const FixedList&)");
#define forAll(list, i)
Loop across all elements in list.
streamFormat format() const
Return current stream format.
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>.
char readEndList(const char *funcName)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds items read from Istream.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
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 &)
char readBeginList(const char *funcName)
label size() const
Return the number of elements in the FixedList.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
void checkSize(const label size) const
Check size is within valid range (0 ... size).
FixedList()
Null constructor.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
InfoProxy< token > info() const
Return info proxy.
T * data()
Return a pointer to the first data element,.
void writeEntry(Ostream &) const
Write the FixedList as a dictionary entry.
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,.
void fatalCheck(const char *operation) const
Check IOstream status for given operation.