45 #ifndef Foam_IOstream_H 46 #define Foam_IOstream_H 68 #define Foam_IOstream_extras 80 Ostream& operator<<(Ostream&, const InfoProxy<IOstream>&);
181 sizeofLabel_(static_cast<unsigned char>(sizeof(label))),
218 virtual bool check(
const char* operation)
const;
245 return ioState_ & std::ios_base::eofbit;
251 return ioState_ & (std::ios_base::badbit | std::ios_base::failbit);
257 return ioState_ & std::ios_base::badbit;
261 explicit operator bool() const
noexcept 302 template<
class T = label>
303 std::enable_if_t<std::is_integral_v<T>,
bool>
311 template<
class T = scalar>
312 std::enable_if_t<std::is_floating_point_v<T>,
bool>
388 virtual std::ios_base::fmtflags
flags()
const = 0;
391 virtual std::ios_base::fmtflags
flags(std::ios_base::fmtflags) = 0;
394 std::ios_base::fmtflags
setf(std::ios_base::fmtflags
f)
400 std::ios_base::fmtflags
setf 402 const std::ios_base::fmtflags
f,
403 const std::ios_base::fmtflags mask
410 std::ios_base::fmtflags
unsetf(std::ios_base::fmtflags
f)
438 typedef IOstream& (*IOstreamManip)(IOstream&);
490 template<
class StreamType>
491 class StreamAllocator
519 template<
class IS,
class Type,
class... Args>
523 if constexpr (
sizeof...(
args))
530 template<
class OS,
class Type,
class... Args>
534 if constexpr (
sizeof...(
args))
label lineNumber_
The file line.
bool opened() const noexcept
True if stream has been opened.
fileName relativeName() const
Return the name of the stream relative to the current case.
bool operator!() const noexcept
True if the stream has failed.
void setFail() noexcept
Set stream state as 'failed'.
A class for handling file names.
bool bad() const noexcept
True if stream is corrupted.
virtual const fileName & name() const
The name of the stream.
void setClosed() noexcept
Set stream closed.
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
IOstream & hex(IOstream &io)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
void setState(std::ios_base::iostate state) noexcept
Set stream state.
streamAccess openClosed_
The stream open/closed state.
streamAccess
Enumeration for stream open/closed state.
static fileName staticName_
Name for any generic stream - normally treat as readonly.
InfoProxy< IOstream > info() const noexcept
Return info proxy, used to print IOstream information to a stream.
StreamAllocator()=default
Default construct (empty)
static unsigned int defaultPrecision() noexcept
Return the default precision.
A simple container for options an IOstream can normally have.
std::ios_base::fmtflags setf(std::ios_base::fmtflags f)
Set stream flag(s), return old stream flags.
IOstream & fixed(IOstream &io)
unsigned scalarByteSize() const noexcept
The sizeof (scalar) in bytes associated with the stream.
IOstream & oct(IOstream &io)
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
A character and a pointer to a character string.
virtual std::ios_base::fmtflags flags() const =0
Return current stream flags.
StreamType stream_
The std::stream.
IOstream(const IOstream &)=default
Copy construct.
void outputLoop(OS &os, const Type &arg1, Args &&... args)
Output looping. Write first parameter and recurse.
void setLabelByteSize(unsigned nbytes) noexcept
Set the sizeof (label) in bytes associated with the stream.
unsigned char sizeofLabel_
The sizeof (label), possibly read from the header.
bool fail() const noexcept
True if next operation will fail.
unsigned char sizeofScalar_
The sizeof (scalar), possibly read from the header.
static unsigned int minPrecision(unsigned int prec) noexcept
Set the minimum default precision.
void inputLoop(IS &is, Type &arg1, Args &&... args)
Input looping. Read into first parameter and recurse.
Representation of a major/minor version number.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
virtual void print(Ostream &os) const
Print stream description to Ostream.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
label lineNumber() const noexcept
Const access to the current stream line number.
virtual ~IOstream()=default
Destructor.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
static unsigned int precision_
Default precision.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
A helper class for outputting values to Ostream.
void setScalarByteSize(unsigned nbytes) noexcept
Set the sizeof (scalar) in bytes associated with the stream.
std::enable_if_t< std::is_floating_point_v< T >, bool > checkScalarSize() const noexcept
Check if the scalar byte-size associated with the stream is the same as the given type...
bool closed() const noexcept
True if stream is closed.
bool good() const noexcept
True if next operation might succeed.
std::enable_if_t< std::is_integral_v< T >, bool > checkLabelSize() const noexcept
Check if the label byte-size associated with the stream is the same as the given type.
streamFormat
Data format (ascii | binary)
std::ios_base::fmtflags unsetf(std::ios_base::fmtflags f)
Unset stream flags, return old stream flags.
void setOpened() noexcept
Set stream opened.
IOstream & dec(IOstream &io)
void setEof() noexcept
Set stream state as reached 'eof'.
void setGood() noexcept
Set stream state to be good.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Foam::argList args(argc, argv)
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes associated with the stream.
bool eof() const noexcept
True if end of input seen.
IOstream &(* IOstreamManip)(IOstream &)
An IOstream manipulator.
void setBad() noexcept
Set stream state to be 'bad'.
IOstream & scientific(IOstream &io)
std::ios_base::iostate ioState_
Mirror of internal stream io state.