Go to the documentation of this file.
32 template<
class T, Foam::label Offset>
38 token::compound::isCompound
50 template<
class T, Foam::label Offset>
59 os << token::END_STATEMENT <<
endl;
62 template<
class T, Foam::label Offset>
69 if( (os.format() == IOstream::ASCII) || !contiguous<T>() )
74 os << DL.size() << token::BEGIN_LIST;
79 if( i != 0 ) os << token::SPACE;
84 os << token::END_LIST;
89 os <<
nl << DL.size() <<
nl << token::BEGIN_LIST;
98 os <<
nl << token::END_LIST <<
nl;
103 os <<
nl << DL.nextFree_ <<
nl;
106 const label blockSize = 1<<DL.shift_;
111 while( currPos < DL.nextFree_ )
114 Foam::min(DL.nextFree_ - currPos, blockSize);
118 reinterpret_cast<const char*
>(DL.dataPtr_[currBlock]),
129 os.check(
"Ostream& operator<<(Ostream&, const LongList&)");
135 template<
class T, Foam::label Offset>
145 is.
fatalCheck(
"operator>>(Istream&, LongList<T, Offset>&)");
147 token firstToken(is);
151 "operator>>(Istream&, LongList<T, Offset>&) : reading first token"
154 if( firstToken.isLabel() )
156 const label size = firstToken.labelToken();
162 if( (is.format() == IOstream::ASCII) || !contiguous<T>() )
165 char listDelimiter = is.readBeginList(
"List");
169 if( listDelimiter != token::BEGIN_LIST )
173 "template<class T, Foam::label Offset>"
175 "Foam::Istream& Foam::operator>>"
178 "Foam::LongList<T, Offset>& DL"
180 ) <<
"Missing ( after 0" <<
endl;
185 listDelimiter = is.readEndList(
"List");
186 if( listDelimiter != token::END_LIST )
190 "template<class T, Foam::label Offset>"
192 "Foam::Istream& Foam::operator>>"
195 "Foam::LongList<T, Offset>& DL"
197 ) <<
"Missing ) after 0(" <<
endl;
203 if( listDelimiter == token::BEGIN_LIST )
205 for(
label i=0;i<size;++i)
211 "operator>>(Istream&, List<T>&) : reading entry"
222 "operator>>(Istream&, List<T>&) : "
223 "reading the single entry"
226 for(
label i=0;i<size;++i)
233 is.readEndList(
"List");
237 const label blockSize = (1<<DL.shift_);
242 while( currPos < size )
248 reinterpret_cast<char*
>(DL.dataPtr_[currBlock]),
258 "operator>>(Istream&, LongList<T, Offset>&)"
259 ": reading the binary block"
266 <<
"incorrect first token, expected <int>, found "
274 template<
class T, Foam::label Offset>
277 is.
fatalCheck(
"appendFromStream(Istream& is)");
279 token firstToken(is);
283 "appendFromStream(Istream& is) : reading first token"
292 Pout <<
"Appending empty stream" <<
endl;
296 label origSize(this->size());
302 if( (is.
format() == IOstream::ASCII) || !contiguous<T>() )
307 if( listDelimiter == token::BEGIN_LIST )
309 for(
label i=0;i<size;++i)
311 is >> this->operator[](origSize);
316 "appendFromStream(Istream& is) : reading entry"
327 "appendFromStream(Istream& is) : "
328 "reading the single entry"
331 for(
label i=0;i<size;++i)
333 this->operator[](origSize) = element;
344 is.
read(
reinterpret_cast<char*
>(buf.begin()), size *
sizeof(
T));
347 this->operator[](origSize++) = buf[i];
351 "appendFromStream(Istream& is)"
352 ": reading the binary block"
359 <<
"incorrect first token, expected <int>, found "
void appendFromStream(Istream &)
Read from stream and append to the current content.
streamFormat format() const
Return current stream format.
points setSize(newPointi)
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
A class for handling words, derived from string.
#define forAll(list, i)
Loop across all elements in list.
char readBeginList(const char *funcName)
char readEndList(const char *funcName)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds items read from Istream.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
InfoProxy< token > info() const
Return info proxy.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void writeEntry(Ostream &os) const
Write as a dictionary entry.
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
prefixOSstream Pout(cout, "Pout")
Traits class for primitives.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual Istream & read(token &)=0
Return next token from stream.