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 typename std::enable_if<std::is_integral<T>::value,
bool>
::type 311 template<
class T = scalar>
312 typename std::enable_if<std::is_floating_point<T>::value,
bool>
::type 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 void unsetf(std::ios_base::fmtflags
f)
438 typedef IOstream& (*IOstreamManip)(IOstream&);
490 template<
class StreamType>
491 class StreamAllocator
519 template<
class IS>
inline void inputLoop(IS&) {}
522 template<
class OS>
inline void outputLoop(OS&) {}
525 template<
class IS,
class Type,
class... Args>
533 template<
class OS,
class Type,
class... 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
Return 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.
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize() const noexcept
Check if the scalar byte-size associated with the stream is the same as the given type...
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.
void unsetf(std::ios_base::fmtflags f)
Unset flags of stream.
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.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
StreamType stream_
The std::stream.
IOstream(const IOstream &)=default
Copy construct.
void setLabelByteSize(unsigned nbytes) noexcept
Set the sizeof (label) in bytes associated with the stream.
void inputLoop(IS &)
Termination for input looping (no-op)
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.
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.
bool closed() const noexcept
True if stream is closed.
bool good() const noexcept
True if next operation might succeed.
streamFormat
Data format (ascii | binary)
void setOpened() noexcept
Set stream opened.
IOstream & dec(IOstream &io)
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize() const noexcept
Check if the label byte-size associated with the stream is the same as the given type.
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)
void outputLoop(OS &)
Termination for output looping (no-op)
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.