An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc. More...
Classes | |
class | versionNumber |
Version number type. More... | |
Public Types | |
enum | streamAccess { OPENED , CLOSED } |
Enumeration for whether the stream open or closed. More... | |
enum | streamFormat { ASCII , BINARY } |
Enumeration for the format of data in the stream. More... | |
enum | compressionType { UNCOMPRESSED , COMPRESSED } |
Enumeration for the format of data in the stream. More... | |
Public Member Functions | |
IOstream (streamFormat format, versionNumber version, compressionType compression=UNCOMPRESSED) | |
Construct setting format and version. More... | |
virtual | ~IOstream () |
Destructor. More... | |
virtual const fileName & | name () const |
Return the name of the stream. More... | |
virtual fileName & | name () |
Return non-const access to the name of the stream. More... | |
virtual bool | check (const char *operation) const |
Check IOstream status for given operation. More... | |
void | fatalCheck (const char *operation) const |
Check IOstream status for given operation. More... | |
bool | opened () const |
Return true if stream has been opened. More... | |
bool | closed () const |
Return true if stream is closed. More... | |
bool | good () const |
Return true if next operation might succeed. More... | |
bool | eof () const |
Return true if end of input seen. More... | |
bool | fail () const |
Return true if next operation will fail. More... | |
bool | bad () const |
Return true if stream is corrupted. More... | |
operator void * () const | |
Return non-zero if the stream has not failed. More... | |
bool | operator! () const |
Return true if the stream has failed. More... | |
streamFormat | format () const |
Return current stream format. More... | |
streamFormat | format (const streamFormat fmt) |
Set the stream format. More... | |
streamFormat | format (const word &fmt) |
Set the stream format from word. More... | |
versionNumber | version () const |
Return the stream version. More... | |
versionNumber | version (const versionNumber ver) |
Set the stream version. More... | |
compressionType | compression () const |
Return the stream compression. More... | |
compressionType | compression (const compressionType cmp) |
Set the stream compression. More... | |
compressionType | compression (const word &cmp) |
Set the stream compression from word. More... | |
label | lineNumber () const |
Return current stream line number. More... | |
label & | lineNumber () |
Return current stream line number. More... | |
label | lineNumber (const label ln) |
Set the stream line number. More... | |
virtual ios_base::fmtflags | flags () const =0 |
Return flags of stream. More... | |
void | setEof () |
Set stream to have reached eof. More... | |
void | setFail () |
Set stream to have failed. More... | |
void | setBad () |
Set stream to be bad. More... | |
virtual ios_base::fmtflags | flags (const ios_base::fmtflags f)=0 |
Set flags of stream. More... | |
ios_base::fmtflags | setf (const ios_base::fmtflags f) |
Set flags of stream. More... | |
ios_base::fmtflags | setf (const ios_base::fmtflags f, const ios_base::fmtflags mask) |
Set flags of given field of stream. More... | |
void | unsetf (const ios_base::fmtflags uf) |
Unset flags of stream. More... | |
virtual void | print (Ostream &) const |
Print description of IOstream to Ostream. More... | |
void | print (Ostream &, const int streamState) const |
Check given stream state bits. More... | |
InfoProxy< IOstream > | info () const |
Return info proxy. More... | |
Static Public Member Functions | |
static streamFormat | formatEnum (const word &) |
Return stream format of given format name. More... | |
static compressionType | compressionEnum (const word &) |
Return compression of given compression name. More... | |
static unsigned int | defaultPrecision () |
Return the default precision. More... | |
static unsigned int | defaultPrecision (unsigned int p) |
Reset the default precision (and return old precision) More... | |
Static Public Attributes | |
static const versionNumber | currentVersion |
Current version number. More... | |
static unsigned int | precision_ |
Default precision. More... | |
Protected Member Functions | |
void | setOpened () |
Set stream opened. More... | |
void | setClosed () |
Set stream closed. More... | |
void | setState (ios_base::iostate state) |
Set stream state. More... | |
void | setGood () |
Set stream to be good. More... | |
Protected Attributes | |
label | lineNumber_ |
Friends | |
Ostream & | operator<< (Ostream &os, const streamFormat &sf) |
Ostream operator. More... | |
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
The basic operations are construct, close, read token, read primitive and read binary block. In addition version control and line number counting is incorporated. Usually one would use the read primitive member functions, but if one were reading a stream on unknown data sequence one can read token by token, and then analyse.
Definition at line 71 of file IOstream.H.
enum streamAccess |
Enumeration for whether the stream open or closed.
Enumerator | |
---|---|
OPENED | |
CLOSED |
Definition at line 79 of file IOstream.H.
enum streamFormat |
Enumeration for the format of data in the stream.
Enumerator | |
---|---|
ASCII | |
BINARY |
Definition at line 86 of file IOstream.H.
enum compressionType |
Enumeration for the format of data in the stream.
Enumerator | |
---|---|
UNCOMPRESSED | |
COMPRESSED |
Definition at line 193 of file IOstream.H.
|
inline |
Construct setting format and version.
Definition at line 265 of file IOstream.H.
References IOstream::setBad().
|
inlinevirtual |
Destructor.
Definition at line 284 of file IOstream.H.
|
inlineprotected |
Set stream opened.
Definition at line 236 of file IOstream.H.
References IOstream::OPENED.
Referenced by IFstream::IFstream(), ISstream::ISstream(), ITstream::ITstream(), OFstream::OFstream(), ITstream::operator=(), OSstream::OSstream(), and UOPstream::UOPstream().
|
inlineprotected |
Set stream closed.
Definition at line 242 of file IOstream.H.
References IOstream::CLOSED.
Referenced by IFstream::IFstream(), and OFstream::OFstream().
|
inlineprotected |
Set stream state.
Definition at line 248 of file IOstream.H.
Referenced by IFstream::IFstream(), ISstream::ISstream(), OFstream::OFstream(), OSstream::OSstream(), and OSstream::write().
|
inlineprotected |
Set stream to be good.
Definition at line 254 of file IOstream.H.
Referenced by ISstream::ISstream(), ITstream::ITstream(), ITstream::operator=(), OSstream::OSstream(), and UOPstream::UOPstream().
|
inlinevirtual |
Return the name of the stream.
Useful for Fstream to return the filename
Reimplemented in ITstream, OSstream, ISstream, OFstream, IFstream, and primitiveEntry.
Definition at line 294 of file IOstream.H.
Referenced by globalIndexAndTransform::addToTransformIndex(), mappedInternalPatchBase::calcMapping(), ifeqEntry::execute(), functionEntry::execute(), includeFvConstraintEntry::execute(), includeFvModelEntry::execute(), includeEntry::execute(), includeFuncEntry::execute(), includeEntry::includeFileName(), LocalInteraction< CloudType >::info(), Foam::MeshToMeshMapVolInternalFields(), entry::New(), Foam::operator>>(), wallBoiling::precompute(), decomposedBlockData::readBlock(), decomposedBlockData::readBlocks(), IOobject::readHeader(), unitConversion::readIfPresent(), decomposedBlockData::readMasterHeader(), IOerror::SafeFatalIOError(), coupledTemperatureFvPatchScalarField::updateCoeffs(), timeVaryingMappedFvPatchField< Type >::write(), mappedInternalPatchBase::write(), rigidBodyModel::write(), sixDoFRigidBodyMotion::write(), restraint::write(), edgeMeshFormat::write(), CloudSubModelBase< CloudType >::write(), omega::write(), STARCDedgeFormat::writeCase(), STARCDsurfaceFormatCore::writeCase(), and GeometricBoundaryField< Type, PatchField, GeoMesh >::writeEntry().
|
inlinevirtual |
Return non-const access to the name of the stream.
Useful to alter the stream name
Reimplemented in ITstream, OSstream, ISstream, OFstream, IFstream, and primitiveEntry.
Definition at line 301 of file IOstream.H.
|
virtual |
Check IOstream status for given operation.
print IOstream state if error has occurred
Definition at line 92 of file IOstream.C.
References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::name().
Referenced by CollidingParcel< ParcelType >::CollidingParcel(), CollisionRecordList< PairType, WallType >::CollisionRecordList(), DSMCParcel< ParcelType >::DSMCParcel(), fieldAverageItem::fieldAverageItem(), findCellParticle::findCellParticle(), FixedList< label, 6 >::FixedList(), ignitionSite::ignitionSite(), molecule::molecule(), MomentumParcel< ParcelType >::MomentumParcel(), momentumParcelInjectionData::momentumParcelInjectionData(), MPPICParcel< ParcelType >::MPPICParcel(), objectMap::objectMap(), Foam::operator<<(), Foam::operator>>(), Foam::RBD::operator>>(), PairCollisionRecord< Type >::PairCollisionRecord(), particle::particle(), phaseProperties::phaseProperties(), polyBoundaryMesh::polyBoundaryMesh(), pyramid< Point, PointRef, polygonRef >::pyramid(), ReactingMultiphaseParcel< ParcelType >::ReactingMultiphaseParcel(), reactingMultiphaseParcelInjectionData::reactingMultiphaseParcelInjectionData(), ReactingParcel< ParcelType >::ReactingParcel(), reactingParcelInjectionData::reactingParcelInjectionData(), IOPosition< CloudType >::readData(), dimensionSet::readNoBegin(), ensightPart::reconstruct(), sampledSetParticle::sampledSetParticle(), PackedList< nBits >::setPair(), solidParticle::solidParticle(), SprayParcel< ParcelType >::SprayParcel(), streamlinesParticle::streamlinesParticle(), surfacePatchIOList::surfacePatchIOList(), surfZoneIOList::surfZoneIOList(), ThermoParcel< ParcelType >::ThermoParcel(), thermoParcelInjectionData::thermoParcelInjectionData(), trackedParticle::trackedParticle(), VectorSpace< Form, Cmpt, Ncmpts >::VectorSpace(), WallCollisionRecord< Type >::WallCollisionRecord(), wordAndDictionary::wordAndDictionary(), OFSsurfaceFormat< Face >::write(), dictionaryListEntry::write(), triSurface::write(), SHA1Digest::write(), edgeMeshFormat::write(), dimensionSet::write(), polyBoundaryMesh::writeData(), ensightParts::writeData(), DimensionedField< Type, GeoMesh >::writeData(), GeometricBoundaryField< Type, PatchField, GeoMesh >::writeEntry(), GeometricFieldSources< Type, GeoMesh >::writeEntry(), and particle::writePosition().
void fatalCheck | ( | const char * | operation | ) | const |
Check IOstream status for given operation.
print IOstream state if error has occurred and exit
Definition at line 105 of file IOstream.C.
References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::name().
Referenced by dictionaryEntry::dictionaryEntry(), functionEntry::execute(), entry::New(), decomposedBlockData::numBlocks(), Foam::operator>>(), primitiveEntry::read(), PackedList< nBits >::read(), PtrList< T >::read(), Foam::blockMeshTools::read(), decomposedBlockData::readBlock(), decomposedBlockData::readBlocks(), and decomposedBlockData::readMasterHeader().
|
inline |
Return true if stream has been opened.
Definition at line 318 of file IOstream.H.
References IOstream::OPENED.
|
inline |
Return true if stream is closed.
Definition at line 324 of file IOstream.H.
References IOstream::CLOSED.
|
inline |
Return true if next operation might succeed.
Definition at line 330 of file IOstream.H.
Referenced by collatedFileOperation::appendObject(), Foam::debug::controlDict(), dynamicCode::copyAndFilter(), dynamicCode::copyOrCreateFiles(), dynamicCode::createMakeFiles(), dynamicCode::createMakeOptions(), AC3DsurfaceFormatCore::cueTo(), error::error(), edgeMeshFormatsCore::getLineNoComment(), surfaceFormatsCore::getLineNoComment(), IFstream::IFstream(), dictionary::includedDictionary::includedDictionary(), meanVelocityForce::meanVelocityForce(), noiseFFT::noiseFFT(), decomposedBlockData::numBlocks(), OFstream::OFstream(), Foam::operator>>(), argList::parse(), extendedFeatureEdgeMeshFormat::read(), NASedgeFormat::read(), OBJedgeFormat::read(), STARCDedgeFormat::read(), VTKedgeFormat::read(), extendedEdgeMeshFormat::read(), AC3DsurfaceFormat< Face >::read(), GTSsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), OBJsurfaceFormat< Face >::read(), OFFsurfaceFormat< Face >::read(), OFSsurfaceFormat< Face >::read(), STARCDsurfaceFormat< Face >::read(), VTKsurfaceFormat< Face >::read(), TableFileReader< Type >::read(), dictionary::read(), edgeMeshFormat::read(), masterUncollatedFileOperation::readAndSend(), decomposedBlockData::readBlocks(), STARCD::readBoundary(), AC3DsurfaceFormatCore::readCmd(), Foam::readCmd(), externalCoupledMixedFvPatchField< Type >::readData(), GlobalIOListBase< Container, IOContainer, Type >::readData(), STARCDCore::readHeader(), STARCD::readHeader(), masterUncollatedFileOperation::readHeader(), IOobject::readHeader(), STARCDsurfaceFormatCore::readInpCellTable(), STARCDCore::readPoints(), Foam::readUpto(), scalarRanges::scalarRanges(), specieCoeffs::setLRhs(), memInfo::update(), OBJedgeFormat::write(), VTKedgeFormat::write(), GTSsurfaceFormat< Face >::write(), AC3DsurfaceFormat< Face >::write(), OBJsurfaceFormat< Face >::write(), OFFsurfaceFormat< Face >::write(), OFSsurfaceFormat< Face >::write(), SMESHsurfaceFormat< Face >::write(), TRIsurfaceFormat< Face >::write(), VTKsurfaceFormat< Face >::write(), WRLsurfaceFormat< Face >::write(), X3DsurfaceFormat< Face >::write(), dictionary::write(), edgeMeshFormat::write(), dynamicIndexedOctree< Type >::write(), indexedOctree< Type >::write(), STLsurfaceFormat< Face >::writeAscii(), correlationFunction< Type >::writeAveraged(), decomposedBlockData::writeBlocks(), SecondaryPropertyModel< ModelType >::writeData(), populationBalanceModel::writeData(), AveragingMethod< Type >::writeData(), extendedFeatureEdgeMesh::writeData(), featureEdgeMesh::writeData(), decomposedBlockData::writeData(), IOdictionary::writeData(), GeometricField< Type, PatchField, GeoMesh >::writeData(), polyBoundaryMesh::writeData(), ZoneList< ZoneType, ZonesType, MeshType >::writeData(), refinementHistory::writeData(), surfZoneIOList::writeData(), surfacePatchIOList::writeData(), DimensionedField< Type, GeoMesh >::writeData(), dragModel::writeData(), heatTransferModel::writeData(), interfaceSaturationTemperatureModel::writeData(), phaseTransferModel::writeData(), virtualMassModel::writeData(), BlendedInterfacialModel< ModelType >::writeData(), SidedInterfacialModel< ModelType >::writeData(), wallBoilingHeatTransfer::writeData(), fvConstraints::writeData(), fvModels::writeData(), porosityModelList::writeData(), AverageField< Type >::writeData(), fieldDictionary::writeData(), IOPosition< CloudType >::writeData(), cellModel::writeData(), liquidProperties::writeData(), constant::writeData(), temperatureDependent::writeData(), surfaceTensionModel::writeData(), dynamicCode::writeDigest(), pairPotential::writeEnergyAndForceTables(), IOobject::writeHeader(), collatedFileOperation::writeObject(), fileOperation::writeObject(), masterUncollatedFileOperation::writeObject(), and externalCoupledMixedFvPatchField< scalar >::~externalCoupledMixedFvPatchField().
|
inline |
Return true if end of input seen.
Definition at line 336 of file IOstream.H.
Referenced by ifeqEntry::execute(), gaussGrad< Type >::gaussGrad(), convectionScheme< Type >::New(), d2dt2Scheme< Type >::New(), ddtScheme< Type >::New(), divScheme< Type >::New(), gradScheme< Type >::New(), laplacianScheme< Type, GType >::New(), snGradScheme< Type >::New(), limitedSurfaceInterpolationScheme< Type >::New(), surfaceInterpolationScheme< Type >::New(), Function1< Type >::New(), Function2< Type >::New(), entry::New(), noiseFFT::noiseFFT(), Foam::operator>>(), dictionary::read(), and solution::upgradeSolverDict().
|
inline |
Return true if next operation will fail.
Definition at line 342 of file IOstream.H.
Referenced by IOstream::operator void *(), and IOstream::operator!().
|
inline |
Return true if stream is corrupted.
Definition at line 348 of file IOstream.H.
Referenced by Foam::operator<<(), Istream::putBack(), primitiveEntry::read(), GTSsurfaceFormat< Face >::read(), dictionary::read(), fvConstraints::readData(), fvModels::readData(), coordinateSystems::readData(), extendedFeatureEdgeMesh::readData(), featureEdgeMesh::readData(), IOdictionary::readData(), and refinementHistory::readData().
|
inline |
Return non-zero if the stream has not failed.
Definition at line 354 of file IOstream.H.
References IOstream::fail().
|
inline |
Return true if the stream has failed.
Definition at line 362 of file IOstream.H.
References IOstream::fail().
|
static |
Return stream format of given format name.
Definition at line 39 of file IOstream.C.
References IOstream::ASCII, IOstream::BINARY, Foam::endl(), IOstream::format(), and WarningInFunction.
Referenced by IOstream::format(), setWriter::New(), Time::readDict(), ensightSurfaceWriter::surfaceWriter(), and decomposedBlockData::writeData().
|
inline |
Return current stream format.
Definition at line 374 of file IOstream.H.
Referenced by collatedFileOperation::appendObject(), CollidingParcel< ParcelType >::CollidingParcel(), DSMCParcel< ParcelType >::DSMCParcel(), includeEntry::execute(), findCellParticle::findCellParticle(), FixedList< label, 6 >::FixedList(), IOstream::formatEnum(), molecule::molecule(), MomentumParcel< ParcelType >::MomentumParcel(), MPPICParcel< ParcelType >::MPPICParcel(), decomposedBlockData::numBlocks(), Foam::operator<<(), Foam::operator>>(), particle::particle(), ReactingMultiphaseParcel< ParcelType >::ReactingMultiphaseParcel(), PackedList< nBits >::read(), masterUncollatedFileOperation::read(), uncollatedFileOperation::read(), decomposedBlockData::readBlock(), IOobject::readHeader(), Foam::setformat(), solidParticle::solidParticle(), SprayParcel< ParcelType >::SprayParcel(), ThermoParcel< ParcelType >::ThermoParcel(), trackedParticle::trackedParticle(), decomposedBlockData::writeData(), IOobject::writeHeader(), and particle::writePosition().
|
inline |
Set the stream format.
Definition at line 380 of file IOstream.H.
|
inline |
Set the stream format from word.
Definition at line 388 of file IOstream.H.
References IOstream::formatEnum().
|
inline |
Return the stream version.
Definition at line 396 of file IOstream.H.
Referenced by collatedFileOperation::appendObject(), includeEntry::execute(), decomposedBlockData::numBlocks(), decomposedBlockData::readBlock(), IOobject::readHeader(), Foam::setversion(), decomposedBlockData::writeData(), and IOobject::writeHeader().
|
inline |
Set the stream version.
Definition at line 402 of file IOstream.H.
|
static |
Return compression of given compression name.
Definition at line 61 of file IOstream.C.
References IOstream::COMPRESSED, Foam::endl(), IOstream::UNCOMPRESSED, Switch::valid(), and WarningInFunction.
Referenced by IOstream::compression(), setWriter::New(), and Time::readDict().
|
inline |
Return the stream compression.
Definition at line 413 of file IOstream.H.
Referenced by Foam::setcompression().
|
inline |
Set the stream compression.
Definition at line 419 of file IOstream.H.
|
inline |
Set the stream compression from word.
Definition at line 427 of file IOstream.H.
References IOstream::compressionEnum().
|
inline |
Return current stream line number.
Definition at line 435 of file IOstream.H.
References IOstream::lineNumber_.
Referenced by ifeqEntry::execute(), functionEntry::execute(), includeFvConstraintEntry::execute(), includeFvModelEntry::execute(), includeFuncEntry::execute(), ITstream::print(), NASedgeFormat::read(), NASsurfaceFormat< Face >::read(), IOobject::readHeader(), unitConversion::readIfPresent(), and IOerror::SafeFatalIOError().
|
inline |
Return current stream line number.
Definition at line 441 of file IOstream.H.
References IOstream::lineNumber_.
Set the stream line number.
Definition at line 447 of file IOstream.H.
References IOstream::lineNumber_, and Foam::ln().
|
pure virtual |
Return flags of stream.
Implemented in ITstream, OSstream, ISstream, UOPstream, UIPstream, dummyIstream, and dummyISstream.
Referenced by IOstream::setf(), and IOstream::unsetf().
|
inlinestatic |
Return the default precision.
Definition at line 458 of file IOstream.H.
References IOstream::precision_.
Referenced by writeFile::charWidth(), Foam::getVariable(), probes::prepare(), Time::readDict(), thermo< Thermo, Type >::T(), writeFile::valueWidth(), domainDecomposition::writeComplete(), and domainDecomposition::writeProcs().
|
inlinestatic |
Reset the default precision (and return old precision)
Definition at line 464 of file IOstream.H.
References p, and IOstream::precision_.
|
inline |
Set stream to have reached eof.
Definition at line 472 of file IOstream.H.
|
inline |
Set stream to have failed.
Definition at line 478 of file IOstream.H.
|
inline |
Set stream to be bad.
Definition at line 484 of file IOstream.H.
Referenced by IFstream::IFstream(), IOstream::IOstream(), OFstream::OFstream(), and Foam::operator>>().
|
pure virtual |
Set flags of stream.
Implemented in ITstream, UOPstream, UIPstream, OSstream, ISstream, dummyIstream, and dummyISstream.
|
inline |
Set flags of stream.
Definition at line 493 of file IOstream.H.
References f(), and IOstream::flags().
Referenced by Foam::meshCheck::checkTopology(), Foam::dec(), ensightAsciiStream::ensightAsciiStream(), ensightFile::ensightFile(), Foam::fixed(), Foam::hex(), writeFile::initStream(), Foam::oct(), Foam::scientific(), Foam::setf(), and STARCDCore::writePoints().
|
inline |
Set flags of given field of stream.
Definition at line 499 of file IOstream.H.
References f(), and IOstream::flags().
|
inline |
Unset flags of stream.
Definition at line 509 of file IOstream.H.
References IOstream::flags().
|
virtual |
Print description of IOstream to Ostream.
Reimplemented in ITstream, OStringStream, IStringStream, prefixOSstream, OSstream, ISstream, UOPstream, UIPstream, OFstream, and IFstream.
Definition at line 126 of file IOstream.C.
References Foam::endl().
Referenced by ISstream::print(), OSstream::print(), and ITstream::print().
void print | ( | Ostream & | os, |
const int | streamState | ||
) | const |
Check given stream state bits.
Definition at line 177 of file IOstream.C.
References Foam::endl().
Return info proxy.
Used to print IOstream information to a stream
Definition at line 528 of file IOstream.H.
Referenced by IFstream::IFstream(), main(), OFstream::OFstream(), Foam::operator+(), Foam::operator-(), Foam::operator>>(), dimensionSet::read(), dimensionSet::readNoBegin(), and IOobject::writeHeader().
|
friend |
Ostream operator.
|
static |
Current version number.
Definition at line 203 of file IOstream.H.
Referenced by collatedFileOperation::appendObject(), decomposedBlockData::readBlock(), IOobject::readHeader(), rigidBodyMeshMotion::write(), rigidBodyMeshMotionSolver::write(), sixDoFRigidBodyMotionSolver::write(), regIOobject::write(), csvSetWriter::write(), gnuplotSetWriter::write(), rawSetWriter::write(), foamSurfaceWriter::write(), IOobject::writeHeader(), decomposedBlockData::writeHeader(), meshReader::writeMesh(), and Time::writeTimeDict().
|
static |
Default precision.
Definition at line 206 of file IOstream.H.
Referenced by IOstream::defaultPrecision(), and OSstream::OSstream().
|
protected |
Definition at line 228 of file IOstream.H.
Referenced by IFstream::IFstream(), IOstream::lineNumber(), OFstream::OFstream(), and OSstream::write().