40 Foam::IFstreamAllocator::IFstreamAllocator(
const fileName& filePath)
43 compression_(IOstream::UNCOMPRESSED)
53 ifPtr_ =
new ifstream(filePath.c_str());
58 if (
isFile(filePath +
".gz",
false,
false))
67 ifPtr_ =
new igzstream((filePath +
".gz").c_str());
74 else if (
isFile(filePath +
".orig",
false,
false))
78 ifPtr_ =
new ifstream((filePath +
".orig").c_str());
84 Foam::IFstreamAllocator::~IFstreamAllocator()
103 "IFstream.sourceFile_",
106 IFstreamAllocator::compression_
119 <<
"Could not open file for input" <<
endl <<
info() <<
endl;
178 if (
isFile(filePath_,
true,
true))
180 check(
"IFstream::operator()");
186 <<
"file " << filePath_ <<
" does not exist" 191 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)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
ISstream(istream &is, const string &name, streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
Construct as wrapper around istream.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
IFstream(const fileName &filePath, streamFormat format=ASCII, versionNumber version=currentVersion)
Construct from filePath.
virtual istream & stdStream()
Access to underlying std::istream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool good() const
Return true if next operation might succeed.
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.
IFstream & operator()() const
Return a non-const reference to const IFstream.
A std::istream with ability to handle compressed files.
void setState(ios_base::iostate state)
Set stream state.
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
InfoProxy< IOstream > info() const
Return info proxy.
#define InfoInFunction
Report an information message using Foam::Info.