40 Foam::IFstreamAllocator::IFstreamAllocator(
const fileName& pathname)
43 compression_(IOstream::UNCOMPRESSED)
53 ifPtr_ =
new ifstream(pathname.c_str());
56 if (!ifPtr_->good() &&
isFile(pathname +
".gz",
false))
65 ifPtr_ =
new igzstream((pathname +
".gz").c_str());
75 Foam::IFstreamAllocator::~IFstreamAllocator()
94 "IFstream.sourceFile_",
97 IFstreamAllocator::compression_
110 <<
"Could not open file for input" <<
endl <<
info() <<
endl;
169 if (
isFile(pathname_,
true))
171 check(
"IFstream::operator()");
177 <<
"file " << pathname_ <<
" does not exist" 182 return const_cast<IFstream&
>(*this);
A class for handling file names.
void setClosed()
Set stream closed.
errorManipArg< error, int > exit(error &err, const int errNo=1)
InfoProxy< IOstream > info() const
Return info proxy.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
ISstream(istream &is, const string &name, streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
Construct as wrapper around istream.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
bool good() const
Return true if next operation might succeed.
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
virtual istream & stdStream()
Access to underlying std::istream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
IFstream & operator()() const
Return a non-const reference to const IFstream.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
void setBad()
Set stream to be bad.
streamFormat
Enumeration for the format of data in the stream.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
defineTypeNameAndDebug(combustionModel, 0)
void setOpened()
Set stream opened.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
A std::istream with ability to handle compressed files.
IFstream(const fileName &pathname, streamFormat format=ASCII, versionNumber version=currentVersion)
Construct from pathname.
void setState(ios_base::iostate state)
Set stream state.
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
#define InfoInFunction
Report an information message using Foam::Info.