56#ifndef Foam_fstreamPointer_H
57#define Foam_fstreamPointer_H
78 std::unique_ptr<std::istream> ptr_;
86 void reopen_gz(
const std::string& pathname);
141 explicit operator
bool() const
noexcept {
return bool(ptr_); }
144 std::istream*
get()
noexcept {
return ptr_.get(); }
147 const std::istream*
get() const
noexcept {
return ptr_.get(); }
161 const fileName& pathname,
162 IOstreamOption streamOpt = IOstreamOption()
172 void reset(std::istream* ptr)
noexcept { ptr_.reset(ptr); }
178 std::istream&
operator*() {
return *ptr_; }
181 const std::istream&
operator*()
const {
return *ptr_; }
211 std::unique_ptr<std::ostream> ptr_;
220 void clear_mode()
noexcept { mode_ = modeType::NONE; }
228 void reopen(
const std::string& pathname);
231 void close(
const std::string& pathname);
306 explicit operator
bool() const
noexcept {
return bool(ptr_); }
309 std::ostream*
get()
noexcept {
return ptr_.get(); }
320 return (mode_ & modeType::APPENDING);
326 return (mode_ & modeType::ATOMIC);
336 return ptr_.release();
340 void reset(std::ostream* ptr)
noexcept
350 std::ostream&
operator*() {
return *ptr_; }
353 const std::ostream&
operator*()
const {
return *ptr_; }
A simple container for options an IOstream can normally have.
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED).
A class for handling file names.
std::istream * operator->() noexcept
Pointer dereference.
const std::istream * operator->() const noexcept
Pointer dereference.
static bool supports_gz() noexcept
True if compiled with libz support.
~ifstreamPointer()=default
Destructor.
void open(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption())
Attempts to open the specified file for reading.
const std::istream * get() const noexcept
The stream pointer (ifstream or igzstream).
void reopen_gz(const std::string &pathname)
Special 'rewind' method for compressed stream.
std::istream * get() noexcept
The stream pointer (ifstream or igzstream).
IOstreamOption::compressionType whichCompression() const
Which compression type?
void reset(std::istream *ptr) noexcept
Replace the managed pointer.
const std::istream & operator*() const
Const-reference to the stream (no nullptr checking).
std::istream & operator*()
Reference to the stream (no nullptr checking).
void operator=(const ifstreamPointer &)=delete
No copy assignment.
ifstreamPointer() noexcept=default
Default construct (empty).
std::istream * release() noexcept
Return managed pointer and release ownership.
A wrapped std::ofstream with possible compression handling (ogzstream) that behaves much like a std::...
bool is_appending() const noexcept
True if opened in append mode and file already existed.
static bool supports_gz() noexcept
True if compiled with libz support.
const std::ostream & operator*() const
Const-reference to the stream (no nullptr checking).
ofstreamPointer(const ofstreamPointer &)=delete
No copy construct.
void reset(std::ostream *ptr) noexcept
Replace the managed pointer.
ofstreamPointer(ofstreamPointer &&)=default
Move construct.
void operator=(const ofstreamPointer &)=delete
No copy assignment.
std::ostream * operator->() noexcept
Pointer dereference.
std::ostream * get() noexcept
The stream pointer (ofstream or ogzstream).
void reopen(const std::string &pathname)
Reopen for compressed/non-compressed. Discards append status.
const std::ostream * operator->() const noexcept
Pointer dereference.
IOstreamOption::compressionType whichCompression() const
Which compression type?
void close(const std::string &pathname)
Close stream and rename file.
ofstreamPointer() noexcept
Default construct (empty).
const std::ostream * get() const noexcept
The stream pointer (ofstream or ogzstream).
ofstreamPointer & operator=(ofstreamPointer &&)=default
Move assignment.
std::ostream & operator*()
Reference to the stream (no nullptr checking).
bool is_atomic() const noexcept
True if file creation behaves as atomic.
~ofstreamPointer()=default
Destructor.
std::ostream * release() noexcept
Return managed pointer and release ownership.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))