A wrapped std::ofstream
with possible compression handling (ogzstream) that behaves much like a std::unique_ptr
.
More...
Public Member Functions | |
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 () noexcept | |
Default construct (empty) More... | |
ofstreamPointer (std::nullptr_t) | |
Construct as null output stream using Foam::ocountstream. More... | |
ofstreamPointer (const fileName &pathname, IOstreamOption::compressionType comp=IOstreamOption::UNCOMPRESSED, const bool append=false, const bool atomic=false) | |
Construct from pathname, compression, append, file handling atomic. More... | |
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 (const std::string &pathname) |
Reopen for compressed/non-compressed. More... | |
void | close (const std::string &pathname) |
Close stream and rename file. 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 203 of file fstreamPointer.H.
|
delete |
No copy construct.
|
default |
Move construct.
|
default |
Destructor.
|
noexcept |
Default construct (empty)
Definition at line 106 of file fstreamPointers.C.
|
explicit |
Construct as null output stream using Foam::ocountstream.
Definition at line 113 of file fstreamPointers.C.
|
explicit |
Construct from pathname, compression, append, file handling atomic.
pathname | The file name to open for writing |
comp | UNCOMPRESSED | COMPRESSED |
append | Open in append mode |
atomic | Write into temporary file (not target file). This option should only be used with a stream wrapper (eg, OFstream) that handles the final renaming. |
Definition at line 121 of file fstreamPointers.C.
References append(), IOstreamOption::COMPRESSED, Foam::endl(), fileName::FILE, Foam::mode(), Foam::nl, Foam::rm(), fileName::SYMLINK, Foam::type(), IOstreamOption::UNCOMPRESSED, and Foam::Warning.
|
protected |
Reopen for compressed/non-compressed.
Definition at line 253 of file fstreamPointers.C.
Referenced by OFstream::rewind().
|
protected |
Close stream and rename file.
Definition at line 318 of file fstreamPointers.C.
Referenced by OFstream::~OFstream().
|
delete |
No copy assignment.
|
default |
Move assignment.
|
static |
True if compiled with libz support.
Definition at line 46 of file fstreamPointers.C.
Referenced by Time::readDict().
|
inlinenoexcept |
The stream pointer (ofstream or ogzstream)
Definition at line 307 of file fstreamPointer.H.
Referenced by OFstream::rewind(), and OFstream::stdStream().
|
inlinenoexcept |
The stream pointer (ofstream or ogzstream)
Definition at line 312 of file fstreamPointer.H.
Foam::IOstreamOption::compressionType whichCompression | ( | ) | const |
Which compression type?
Definition at line 375 of file fstreamPointers.C.
|
inlinenoexcept |
Return managed pointer and release ownership.
Definition at line 325 of file fstreamPointer.H.
|
inlinenoexcept |
Replace the managed pointer.
Definition at line 330 of file fstreamPointer.H.
|
inline |
Reference to the stream (no nullptr checking)
Definition at line 338 of file fstreamPointer.H.
|
inline |
Const-reference to the stream (no nullptr checking)
Definition at line 343 of file fstreamPointer.H.
|
inlinenoexcept |
Pointer dereference.
Definition at line 348 of file fstreamPointer.H.
|
inlinenoexcept |
Pointer dereference.
Definition at line 353 of file fstreamPointer.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.