Go to the documentation of this file.
51 headerClassName_ = headerDict.
get<
word>(
"class");
53 const word headerObject(headerDict.
get<
word>(
"object"));
63 if (val) sizeofLabel_ =
static_cast<unsigned char>(val);
66 if (val) sizeofScalar_ =
static_cast<unsigned char>(val);
83 if (rOpt_ == MUST_READ || rOpt_ == MUST_READ_IF_MODIFIED)
86 <<
" stream not open for reading essential object from file "
94 <<
" stream not open for reading from file "
101 token firstToken(is);
103 if (is.
good() && firstToken.
isWord(
"FoamFile"))
105 headerDict.
read(is,
false);
117 <<
"First token could not be read or is not 'FoamFile'"
119 <<
"Check header is of the form:" <<
nl <<
endl;
133 if (rOpt_ == MUST_READ || rOpt_ == MUST_READ_IF_MODIFIED)
136 <<
" stream failure while reading header"
139 <<
" for essential object:" <<
name()
146 <<
"Stream failure while reading header"
int debug
Static debugging option.
#define SeriousIOErrorInFunction(ios)
Report an IO error message using Foam::SeriousError.
#define InfoInFunction
Report an information message using Foam::Info.
A class for handling words, derived from Foam::string.
void setLabelByteSize(unsigned nbytes) noexcept
Set the sizeof (label) in bytes associated with the stream.
streamFormat format() const noexcept
Get the current stream format.
void setScalarByteSize(unsigned nbytes) noexcept
Set the sizeof (scalar) in bytes associated with the stream.
label lineNumber() const noexcept
Const access to the current stream line number.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds an item read from Istream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
static void writeHeader(Ostream &os, const word &fieldName)
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
bool good() const noexcept
True if next operation might succeed.
bool readHeader(Istream &is)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
messageStream Info
Information stream (stdout output on master, null elsewhere)
The IOstreamOption is a simple container for options an IOstream can normally have.
virtual const fileName & name() const
Return the name of the stream.
versionNumber version() const noexcept
Get the stream version.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
fileName relativeName() const
Return the name of the stream relative to the current case.
bool read(Istream &is)
Read dictionary from Istream. Discards the header.
errorManipArg< error, int > exit(error &err, const int errNo=1)
unsigned labelByteSize(const std::string &str)
Extract label size (in bytes) from "label=" tag in string.
IOstreamOption parseHeader(const dictionary &headerDict)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
unsigned scalarByteSize(const std::string &str)
Extract scalar size (in bytes) from "scalar=" tag in string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const