A wrapped std::ofstream
with possible compression handling (ogzstream) that behaves much like a std::unique_ptr
.
More...
Public Member Functions | |
ofstreamPointer () noexcept=default | |
Default construct (empty) More... | |
ofstreamPointer (const ofstreamPointer &)=delete | |
No copy construct. More... | |
ofstreamPointer (ofstreamPointer &&)=default | |
Move construct. More... | |
void | operator= (const ofstreamPointer &)=delete |
No copy assignment. More... | |
ofstreamPointer & | operator= (ofstreamPointer &&)=default |
Move assignment. More... | |
~ofstreamPointer ()=default | |
Destructor. More... | |
ofstreamPointer (std::nullptr_t) | |
Construct as null output stream using Foam::ocountstream. More... | |
ofstreamPointer (const fileName &pathname, const bool append) | |
Construct from pathname, with specified append option. More... | |
ofstreamPointer (const fileName &pathname, IOstreamOption::compressionType comp=IOstreamOption::UNCOMPRESSED, const bool append=false) | |
std::ostream * | get () noexcept |
The stream pointer (ofstream or ogzstream) More... | |
const std::ostream * | get () const noexcept |
The stream pointer (ofstream or ogzstream) More... | |
IOstreamOption::compressionType | whichCompression () const |
Which compression type? More... | |
std::ostream * | release () noexcept |
Return managed pointer and release ownership. More... | |
void | reset (std::ostream *ptr) noexcept |
Replace the managed pointer. More... | |
std::ostream & | operator* () |
Reference to the stream (no nullptr checking) More... | |
const std::ostream & | operator* () const |
Const-reference to the stream (no nullptr checking) More... | |
std::ostream * | operator-> () noexcept |
Pointer dereference. More... | |
const std::ostream * | operator-> () const noexcept |
Pointer dereference. More... | |
Static Public Member Functions | |
static bool | supports_gz () |
True if compiled with libz support. More... | |
Protected Member Functions | |
void | reopen_gz (const std::string &pathname_gz) |
Special 'rewind' method for compressed stream. More... | |
void | reopen (const std::string &pathname) |
General 'rewind' method (non-compressed) More... | |
A wrapped std::ofstream
with possible compression handling (ogzstream) that behaves much like a std::unique_ptr
.
operator bool
to avoid inheritance ambiguity with std::ios::operator bool
.Definition at line 161 of file fstreamPointer.H.
|
defaultnoexcept |
Default construct (empty)
|
delete |
No copy construct.
|
default |
Move construct.
|
default |
Destructor.
|
explicit |
Construct as null output stream using Foam::ocountstream.
Definition at line 135 of file fstreamPointers.C.
|
inline |
Construct from pathname, with specified append option.
Definition at line 207 of file fstreamPointer.H.
|
explicit |
Construct from pathname, with preferred compression and specified append option
Definition at line 141 of file fstreamPointers.C.
References append(), IOstreamOption::COMPRESSED, Foam::endl(), Foam::mode(), Foam::nl, Foam::removeConflictingFiles(), IOstreamOption::UNCOMPRESSED, and Foam::Warning.
|
protected |
Special 'rewind' method for compressed stream.
Definition at line 210 of file fstreamPointers.C.
Referenced by OFstream::rewind().
|
protected |
General 'rewind' method (non-compressed)
Definition at line 226 of file fstreamPointers.C.
Referenced by OFstream::rewind().
|
delete |
No copy assignment.
|
default |
Move assignment.
|
static |
True if compiled with libz support.
Definition at line 83 of file fstreamPointers.C.
Referenced by Time::readDict().
|
inlinenoexcept |
The stream pointer (ofstream or ogzstream)
Definition at line 231 of file fstreamPointer.H.
Referenced by OFstream::OFstream(), OFstream::rewind(), and OFstream::stdStream().
|
inlinenoexcept |
The stream pointer (ofstream or ogzstream)
Definition at line 234 of file fstreamPointer.H.
Foam::IOstreamOption::compressionType whichCompression | ( | ) | const |
Which compression type?
Definition at line 257 of file fstreamPointers.C.
References IOstreamOption::COMPRESSED, and IOstreamOption::UNCOMPRESSED.
Referenced by OFstream::rewind().
|
inlinenoexcept |
Return managed pointer and release ownership.
Definition at line 243 of file fstreamPointer.H.
|
inlinenoexcept |
Replace the managed pointer.
Definition at line 246 of file fstreamPointer.H.
|
inline |
Reference to the stream (no nullptr checking)
Definition at line 252 of file fstreamPointer.H.
|
inline |
Const-reference to the stream (no nullptr checking)
Definition at line 255 of file fstreamPointer.H.
|
inlinenoexcept |
Pointer dereference.
Definition at line 258 of file fstreamPointer.H.
|
inlinenoexcept |
Pointer dereference.
Definition at line 261 of file fstreamPointer.H.