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(); }
178 std::istream&
operator*() {
return *ptr_; }
181 const std::istream&
operator*()
const {
return *ptr_; }
195 class ofstreamPointer
200 std::unique_ptr<std::ostream> ptr_;
211 void reopen(
const std::string& pathname);
214 void close(
const std::string& pathname);
256 const
bool append = false,
257 const
bool atomic = false
271 const
bool append = false,
272 const
bool atomic = false
285 explicit operator
bool() const
noexcept {
return bool(ptr_); }
288 std::ostream*
get()
noexcept {
return ptr_.get(); }
291 const std::ostream*
get()
const noexcept {
return ptr_.get(); }
309 std::ostream&
operator*() {
return *ptr_; }
312 const std::ostream&
operator*()
const {
return *ptr_; }
A wrapped std::ifstream with possible compression handling (igzstream) that behaves much like a std::...
std::istream * operator->() noexcept
Pointer dereference.
A wrapped std::ofstream with possible compression handling (ogzstream) that behaves much like a std::...
A class for handling file names.
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
IOstreamOption::compressionType whichCompression() const
Which compression type?
static bool supports_gz()
True if compiled with libz support.
ofstreamPointer() noexcept
Default construct (empty)
static bool supports_gz()
True if compiled with libz support.
void reopen_gz(const std::string &pathname)
Special 'rewind' method for compressed stream.
A simple container for options an IOstream can normally have.
std::ostream * operator->() noexcept
Pointer dereference.
void reset(std::istream *ptr) noexcept
Replace the managed pointer.
std::istream * release() noexcept
Return managed pointer and release ownership.
std::ostream & operator*()
Reference to the stream (no nullptr checking)
~ifstreamPointer()=default
Destructor.
std::ostream * release() noexcept
Return managed pointer and release ownership.
void reopen(const std::string &pathname)
Reopen for compressed/non-compressed.
void operator=(const ofstreamPointer &)=delete
No copy assignment.
ifstreamPointer() noexcept=default
Default construct (empty)
void close(const std::string &pathname)
Close stream and rename file.
std::istream & operator*()
Reference to the stream (no nullptr checking)
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
void operator=(const ifstreamPointer &)=delete
No copy assignment.
IOstreamOption::compressionType whichCompression() const
Which compression type?
void open(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption())
Attempts to open the specified file for reading.
~ofstreamPointer()=default
Destructor.
void reset(std::ostream *ptr) noexcept
Replace the managed pointer.