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);
90 <<
" stream not open for reading essential object from file "
98 <<
" stream not open for reading from file "
105 token firstToken(is);
107 if (is.
good() && firstToken.
isWord(
"FoamFile"))
109 headerDict.
read(is,
false);
121 <<
"First token could not be read or is not 'FoamFile'"
123 <<
"Check header is of the form:" <<
nl <<
endl;
131 objState_ = (is.
good() ? objectState::GOOD : objectState::BAD);
135 Info<<
" .... read - state: "
136 << (objState_ == objectState::GOOD ?
"good" :
"bad")
141 if (objState_ == objectState::BAD)
150 <<
" stream failure while reading header"
153 <<
" for essential object:" <<
name()
160 <<
"Stream failure while reading header"
bool readHeader(Istream &is)
IOstreamOption parseHeader(const dictionary &headerDict)
The IOstreamOption is a simple container for options an IOstream can normally have.
versionNumber version() const noexcept
Get the stream version.
streamFormat format() const noexcept
Get the current stream format.
label lineNumber() const noexcept
Const access to the current stream line number.
bool good() const noexcept
True if next operation might succeed.
virtual const fileName & name() const
Return the name of the stream.
void setLabelByteSize(unsigned nbytes) noexcept
Set the sizeof (label) in bytes associated with the stream.
void setScalarByteSize(unsigned nbytes) noexcept
Set the sizeof (scalar) in bytes associated with the stream.
fileName relativeName() const
Return the name of the stream relative to the current case.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
bool read(Istream &is)
Read dictionary from Istream. Discards the header.
A token holds an item read from Istream.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
#define SeriousIOErrorInFunction(ios)
Report an IO error message using Foam::SeriousError.
#define InfoInFunction
Report an information message using Foam::Info.
unsigned scalarByteSize(const std::string &str)
Extract scalar size (in bytes) from "scalar=" tag in string.
unsigned labelByteSize(const std::string &str)
Extract label size (in bytes) from "label=" tag in string.
static void writeHeader(Ostream &os, const word &fieldName)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)