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_",
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);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A std::istream with ability to handle compressed files.
IFstream & operator()() const
Return a non-const reference to const IFstream.
virtual istream & stdStream()
Access to underlying std::istream.
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
streamFormat
Enumeration for the format of data in the stream.
void setBad()
Set stream to be bad.
void setState(ios_base::iostate state)
Set stream state.
void setClosed()
Set stream closed.
void setOpened()
Set stream opened.
bool good() const
Return true if next operation might succeed.
InfoProxy< IOstream > info() const
Return info proxy.
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A class for handling file names.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define InfoInFunction
Report an information message using Foam::Info.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
defineTypeNameAndDebug(combustionModel, 0)
word format(conversionProperties.lookup("format"))