Go to the documentation of this file.
45 allocatedPtr_(nullptr),
46 detectedCompression_(
IOstream::UNCOMPRESSED)
56 const std::ios_base::openmode
mode(std::ios_base::in|std::ios_base::binary);
87 ISstream(*allocatedPtr_, pathname, streamOpt)
93 setState(allocatedPtr_->rdstate());
100 <<
"Could not open file " << pathname
122 <<
"No stream allocated"
125 return *allocatedPtr_;
134 <<
"No stream allocated"
137 return *allocatedPtr_;
145 igzstream* gzPtr =
nullptr;
149 gzPtr =
dynamic_cast<igzstream*
>(allocatedPtr_.get());
151 catch (
const std::bad_cast&)
161 gzPtr->open((this->
name() +
".gz").c_str());
163 setState(gzPtr->rdstate());
194 <<
"file " << this->
name() <<
" does not exist"
199 return const_cast<IFstream&
>(*this);
int debug
Static debugging option.
IOstream::compressionType detectedCompression_
The detected compression type.
virtual void print(Ostream &os) const
Print stream description to Ostream.
#define InfoInFunction
Report an information message using Foam::Info.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A class for handling file names.
Input from file stream, using an ISstream.
virtual void print(Ostream &os) const
Print stream description to Ostream.
An IOstream is an abstract base class for all input/output systems; be they streams,...
Generic input stream using a standard (STL) stream.
IFstream & operator()() const
Return a non-const reference to const IFstream.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void rewind()
Rewind the stream so that it may be read again.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
A std::istream with the ability to handle compressed files.
word name(const complex &c)
Return string representation of complex.
The IOstreamOption is a simple container for options an IOstream can normally have.
IFstreamAllocator(const fileName &pathname)
Construct from pathname.
errorManip< error > abort(error &err)
IFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption())
Construct from pathname.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual std::istream & stdStream()
Access to underlying std::istream.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void rewind()
Rewind the stream so that it may be read again.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
compressionType compression() const noexcept
Get the stream compression.
defineTypeNameAndDebug(combustionModel, 0)
std::unique_ptr< std::istream > allocatedPtr_
The allocated stream pointer (ifstream or igzstream).