An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc. More...
Data Structures | |
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 | originalVersion |
Original version number. More... | |
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_ |
Private Attributes | |
streamFormat | format_ |
versionNumber | version_ |
compressionType | compression_ |
streamAccess | openClosed_ |
ios_base::iostate | ioState_ |
Static Private Attributes | |
static fileName | name_ |
Name of the stream. More... | |
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 269 of file IOstream.H.
References IOstream::setBad().
|
inlinevirtual |
Destructor.
Definition at line 287 of file IOstream.H.
|
inlineprotected |
Set stream opened.
Definition at line 239 of file IOstream.H.
References IOstream::openClosed_, and IOstream::OPENED.
Referenced by ITstream::ITstream(), and UOPstream::UOPstream().
|
inlineprotected |
Set stream closed.
Definition at line 245 of file IOstream.H.
References IOstream::CLOSED, and IOstream::openClosed_.
|
inlineprotected |
Set stream state.
Definition at line 251 of file IOstream.H.
References IOstream::ioState_.
Referenced by ISstream::get().
|
inlineprotected |
Set stream to be good.
Definition at line 257 of file IOstream.H.
References IOstream::ioState_.
Referenced by ITstream::ITstream(), and UOPstream::UOPstream().
|
inlinevirtual |
Return the name of the stream.
Useful for Fstream to return the filename
Reimplemented in primitiveEntry, ITstream, OFstream, IFstream, ISstream, and OSstream.
Definition at line 297 of file IOstream.H.
Referenced by globalIndexAndTransform::addToTransformIndex(), hexRef8::checkMesh(), functionEntry::execute(), includeEntry::execute(), entry::getKeyword(), includeEntry::includeFileName(), Foam::operator>>(), IOobject::readHeader(), cyclicPeriodicAMIPolyPatch::resetAMI(), IOerror::SafeFatalIOError(), ensightSetWriter< Type >::write(), gnuplotGraph::write(), xmgrGraph::write(), edgeMeshFormat::write(), CloudSubModelBase< CloudType >::write(), sixDoFRigidBodyMotion::write(), STARCDsurfaceFormatCore::writeCase(), STARCDedgeFormat::writeCase(), engineValve::writeDict(), and GeometricField::GeometricBoundaryField::writeEntry().
|
inlinevirtual |
Return non-const access to the name of the stream.
Useful to alter the stream name
Reimplemented in primitiveEntry, ITstream, OFstream, IFstream, ISstream, and OSstream.
Definition at line 304 of file IOstream.H.
|
virtual |
Check IOstream status for given operation.
print IOstream state if error has occured
Definition at line 92 of file IOstream.C.
References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::name().
Referenced by fieldAverageItem::fieldAverageItem(), findCellParticle::findCellParticle(), ignitionSite::ignitionSite(), kinematicParcelInjectionData::kinematicParcelInjectionData(), linear< Type >::linear(), molecule::molecule(), objectMap::objectMap(), Foam::operator<<(), Foam::operator>>(), particle< Type >::particle(), phaseProperties::phaseProperties(), polyBoundaryMesh::polyBoundaryMesh(), reactingMultiphaseParcelInjectionData::reactingMultiphaseParcelInjectionData(), reactingParcelInjectionData::reactingParcelInjectionData(), ZoneMesh< cellZone, polyMesh >::read(), dimensioned< Type >::read(), dimensionSet::read(), IOPosition::readData(), polyTopoChanger::readModifiers(), ensightPart::reconstruct(), solidParticle::solidParticle(), specie::specie(), streamLineParticle::streamLineParticle(), surfacePatchIOList::surfacePatchIOList(), surfZoneIOList::surfZoneIOList(), thermo< Thermo, Type >::thermo(), thermoParcelInjectionData::thermoParcelInjectionData(), trackedParticle::trackedParticle(), wallBoundedParticle::wallBoundedParticle(), wallBoundedStreamLineParticle::wallBoundedStreamLineParticle(), SHA1Digest::write(), edgeMeshFormat::write(), OFSsurfaceFormat< Face >::write(), dimensionSet::write(), triSurface::write(), ensightParts::writeData(), polyBoundaryMesh::writeData(), GeometricField::GeometricBoundaryField::writeEntry(), and particle< Type >::writePosition().
void fatalCheck | ( | const char * | operation | ) | const |
Check IOstream status for given operation.
print IOstream state if error has occured and exit
Definition at line 105 of file IOstream.C.
References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::name().
Referenced by LongList< Foam::meshOctreeCube >::appendFromStream(), dictionaryEntry::dictionaryEntry(), functionEntry::execute(), entry::New(), HashPtrTable< ThermoType >::read(), ILList< DLListBase, entry >::read(), LPtrList< SLListBase, Reaction< Foam::sutherlandTransport > >::read(), PtrList< injectionModel >::read(), primitiveEntry::read(), and PackedList< 2 >::read().
|
inline |
Return true if stream has been opened.
Definition at line 321 of file IOstream.H.
References IOstream::openClosed_, and IOstream::OPENED.
Referenced by sampledSets::writeSampleFile().
|
inline |
Return true if stream is closed.
Definition at line 327 of file IOstream.H.
References IOstream::CLOSED, and IOstream::openClosed_.
|
inline |
Return true if next operation might succeed.
Definition at line 333 of file IOstream.H.
References IOstream::ioState_.
Referenced by topoSetSource::checkIs(), Foam::debug::controlDict(), dynamicCode::copyAndFilter(), dynamicCode::copyOrCreateFiles(), functionObjectFile::createFile(), externalCoupledFunctionObject::createLockFile(), dynamicCode::createMakeFiles(), dynamicCode::createMakeOptions(), AC3DsurfaceFormatCore::cueTo(), directionalPressureGradientExplicitSource::directionalPressureGradientExplicitSource(), error::error(), ISstream::get(), edgeMeshFormatsCore::getLineNoComment(), surfaceFormatsCore::getLineNoComment(), triSurface::getLineNoComment(), main(), meanVelocityForce::meanVelocityForce(), ISstream::nextValid(), noiseFFT::noiseFFT(), IOobject::objectStream(), csvTableReader< Type >::operator()(), Foam::operator>>(), argList::parse(), extendedEdgeMeshFormat::read(), TRIsurfaceFormatCore::read(), extendedFeatureEdgeMeshFormat::read(), NASedgeFormat::read(), OBJsurfaceFormat< Face >::read(), GTSsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), OBJedgeFormat::read(), OFFsurfaceFormat< Face >::read(), VTKsurfaceFormat< Face >::read(), AC3DsurfaceFormat< Face >::read(), edgeMeshFormat::read(), tabulated6DoFAcceleration::read(), CSV::read(), VTKedgeFormat::read(), STARCDsurfaceFormat< Face >::read(), FTRsurfaceFormat< Face >::read(), tabulated6DoFMotion::read(), OFSsurfaceFormat< Face >::read(), STARCDedgeFormat::read(), vtkUnstructuredReader::read(), dictionary::read(), triSurface::readAC(), STARCD::readBoundary(), Foam::readCmd(), AC3DsurfaceFormatCore::readCmd(), triSurface::readGTS(), STARCDCore::readHeader(), STARCD::readHeader(), IOobject::readHeader(), STARCDsurfaceFormatCore::readInpCellTable(), triSurface::readNAS(), triSurface::readOBJ(), triSurface::readOFF(), STARCDCore::readPoints(), triSurface::readSTL(), triSurface::readTRI(), Foam::readUpto(), scalarRanges::scalarRanges(), Reaction::setLRhs(), TableFile::TableFile(), memInfo::update(), externalCoupledFunctionObject::wait(), JobInfo::write(), X3DsurfaceFormat< Face >::write(), WRLsurfaceFormat< Face >::write(), SMESHsurfaceFormat< Face >::write(), GTSsurfaceFormat< Face >::write(), OBJsurfaceFormat< Face >::write(), VTKsurfaceFormat< Face >::write(), AC3DsurfaceFormat< Face >::write(), OBJedgeFormat::write(), OFFsurfaceFormat< Face >::write(), VTKedgeFormat::write(), TRIsurfaceFormat< Face >::write(), edgeMeshFormat::write(), OFSsurfaceFormat< Face >::write(), graph::write(), dictionary::write(), dynamicIndexedOctree::write(), indexedOctree< Foam::treeDataFace >::write(), STLsurfaceFormat< Face >::writeAscii(), correlationFunction::writeAveraged(), ensightSurfaceWriter::writeCollated(), fieldDictionary::writeData(), IOPosition::writeData(), featureEdgeMesh::writeData(), UniformDimensionedField< vector >::writeData(), surfZoneIOList::writeData(), surfacePatchIOList::writeData(), IOdictionary::writeData(), AverageIOField< Type >::writeData(), porosityModelList::writeData(), coordinateSystems::writeData(), extendedFeatureEdgeMesh::writeData(), polyTopoChanger::writeData(), cellModel::writeData(), AveragingMethod< Foam::Vector >::writeData(), ZoneMesh< cellZone, polyMesh >::writeData(), MRFZoneList::writeData(), optionList::writeData(), polyBoundaryMesh::writeData(), refinementHistory::writeData(), GeometricField< vector, pointPatchField, pointMesh >::writeData(), dynamicCode::writeDigest(), pairPotential::writeEnergyAndForceTables(), IOobject::writeHeader(), and regIOobject::writeObject().
|
inline |
Return true if end of input seen.
Definition at line 339 of file IOstream.H.
References IOstream::ioState_.
Referenced by topoSetSource::checkIs(), Time::findTimes(), gaussGrad< Type >::gaussGrad(), entry::getKeyword(), snGradScheme< Type >::New(), gradScheme< Type >::New(), surfaceInterpolationScheme< scalar >::New(), d2dt2Scheme< Type >::New(), ddtScheme< Type >::New(), divScheme< Type >::New(), convectionScheme< Type >::New(), limitedSurfaceInterpolationScheme< Type >::New(), laplacianScheme< Type, GType >::New(), Reaction::New(), noiseFFT::noiseFFT(), PtrList< injectionModel >::read(), dictionary::read(), and solution::upgradeSolverDict().
|
inline |
Return true if next operation will fail.
Definition at line 345 of file IOstream.H.
References IOstream::ioState_.
Referenced by IOstream::operator void *(), and IOstream::operator!().
|
inline |
Return true if stream is corrupted.
Definition at line 351 of file IOstream.H.
References IOstream::ioState_.
Referenced by entry::getKeyword(), ISstream::nextValid(), Foam::operator<<(), Istream::putBack(), GTSsurfaceFormat< Face >::read(), primitiveEntry::read(), dictionary::read(), featureEdgeMesh::readData(), IOdictionary::readData(), extendedFeatureEdgeMesh::readData(), refinementHistory::readData(), and triSurface::readGTS().
|
inline |
Return non-zero if the stream has not failed.
Definition at line 357 of file IOstream.H.
References IOstream::fail().
|
inline |
Return true if the stream has failed.
Definition at line 365 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 ensightSurfaceWriter::ensightSurfaceWriter(), IOstream::format(), and Time::readDict().
|
inline |
Return current stream format.
Definition at line 377 of file IOstream.H.
References IOstream::format_.
Referenced by LongList< Foam::meshOctreeCube >::appendFromStream(), calcEntry::execute(), codeStream::execute(), fanFvPatchField< Type >::fanFvPatchField(), findCellParticle::findCellParticle(), IOstream::formatEnum(), molecule::molecule(), Foam::operator<<(), Foam::operator>>(), particle< Type >::particle(), PackedList< 2 >::read(), IOobject::readHeader(), Foam::setformat(), solidParticle::solidParticle(), trackedParticle::trackedParticle(), wallBoundedParticle::wallBoundedParticle(), csvTableReader< Type >::write(), dimensionSet::write(), PackedList< 2 >::write(), CSV::writeData(), IOobject::writeHeader(), and particle< Type >::writePosition().
|
inline |
|
inline |
Set the stream format from word.
Definition at line 391 of file IOstream.H.
References IOstream::format_, and IOstream::formatEnum().
|
inline |
Return the stream version.
Definition at line 399 of file IOstream.H.
References IOstream::version_.
Referenced by Foam::operator>>(), IOobject::readHeader(), mappedPatchBase::readListOrField(), Foam::setversion(), and IOobject::writeHeader().
|
inline |
|
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(), and Time::readDict().
|
inline |
Return the stream compression.
Definition at line 416 of file IOstream.H.
References IOstream::compression_.
Referenced by Foam::setcompression().
|
inline |
Set the stream compression.
Definition at line 422 of file IOstream.H.
References IOstream::compression_.
|
inline |
Set the stream compression from word.
Definition at line 430 of file IOstream.H.
References IOstream::compression_, and IOstream::compressionEnum().
|
inline |
Return current stream line number.
Definition at line 438 of file IOstream.H.
References IOstream::lineNumber_.
Referenced by functionEntry::execute(), calcEntry::execute(), codeStream::execute(), ITstream::print(), NASedgeFormat::read(), NASsurfaceFormat< Face >::read(), vtkUnstructuredReader::read(), primitiveEntry::readEntry(), IOobject::readHeader(), triSurface::readNAS(), blockMesh::readPatches(), ITstream::rewind(), and IOerror::SafeFatalIOError().
|
inline |
Return current stream line number.
Definition at line 444 of file IOstream.H.
References IOstream::lineNumber_.
Set the stream line number.
Definition at line 450 of file IOstream.H.
References IOstream::lineNumber_, and Foam::ln().
|
pure virtual |
Return flags of stream.
Implemented in ITstream, UIPstream, ISstream, UOPstream, and OSstream.
Referenced by IOstream::setf(), and IOstream::unsetf().
|
inlinestatic |
Return the default precision.
Definition at line 461 of file IOstream.H.
References IOstream::precision_.
Referenced by functionObjectFile::charWidth(), volumeOptimizer::evaluateGradientsExact(), getMergeDistance(), main(), probes::prepare(), functionObjectFile::read(), Time::readDict(), redistributeAndWrite(), functionObjectFile::valueWidth(), and domainDecomposition::writeDecomposition().
|
inlinestatic |
Reset the default precision (and return old precision)
Definition at line 467 of file IOstream.H.
References p, and IOstream::precision_.
|
inline |
Set stream to have reached eof.
Definition at line 475 of file IOstream.H.
References IOstream::ioState_.
Referenced by UIPstream::checkEof().
|
inline |
Set stream to have failed.
Definition at line 481 of file IOstream.H.
References IOstream::ioState_.
|
inline |
Set stream to be bad.
Definition at line 487 of file IOstream.H.
References IOstream::ioState_.
Referenced by IOstream::IOstream(), and Foam::operator>>().
|
pure virtual |
|
inline |
Set flags of stream.
Definition at line 496 of file IOstream.H.
References f(), and IOstream::flags().
Referenced by Foam::checkTopology(), Foam::dec(), ensightAsciiStream::ensightAsciiStream(), Foam::fixed(), nastranSurfaceWriter::formatOS(), Foam::hex(), functionObjectFile::initStream(), Foam::oct(), Foam::scientific(), Foam::setf(), ensightSetWriter< Type >::write(), nastranSurfaceWriter::writeCoord(), nastranSurfaceWriter::writeFace(), nastranSurfaceWriter::writeFaceValue(), nastranSurfaceWriter::writeKeyword(), STARCD::writePoints(), and STARCDCore::writePoints().
|
inline |
Set flags of given field of stream.
Definition at line 503 of file IOstream.H.
References f(), and IOstream::flags().
|
inline |
Unset flags of stream.
Definition at line 512 of file IOstream.H.
References IOstream::flags().
Referenced by nastranSurfaceWriter::writeCoord(), nastranSurfaceWriter::writeFace(), nastranSurfaceWriter::writeFaceValue(), and nastranSurfaceWriter::writeKeyword().
|
virtual |
Print description of IOstream to Ostream.
Reimplemented in UOPstream, ITstream, ISstream, OSstream, UIPstream, prefixOSstream, OFstream, IFstream, OStringStream, and IStringStream.
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 531 of file IOstream.H.
Referenced by dimensionSet::read(), and IOobject::writeHeader().
|
friend |
Ostream operator.
|
static |
Original version number.
Definition at line 203 of file IOstream.H.
Referenced by Foam::operator>>().
|
static |
Current version number.
Definition at line 206 of file IOstream.H.
Referenced by regionModel::evolve(), functionObjectList::execute(), main(), regIOobject::write(), meshReader::writeMesh(), and meshReader::writeMeshLabelList().
|
static |
Default precision.
Definition at line 209 of file IOstream.H.
Referenced by IOstream::defaultPrecision(), and functionObjectList::execute().
|
staticprivate |
Name of the stream.
Definition at line 217 of file IOstream.H.
|
private |
Definition at line 219 of file IOstream.H.
Referenced by IOstream::format().
|
private |
Definition at line 220 of file IOstream.H.
Referenced by IOstream::version().
|
private |
Definition at line 221 of file IOstream.H.
Referenced by IOstream::compression().
|
private |
Definition at line 223 of file IOstream.H.
Referenced by IOstream::closed(), IOstream::opened(), IOstream::setClosed(), and IOstream::setOpened().
|
private |
Definition at line 224 of file IOstream.H.
Referenced by IOstream::bad(), IOstream::eof(), IOstream::fail(), IOstream::good(), IOstream::setBad(), IOstream::setEof(), IOstream::setFail(), IOstream::setGood(), and IOstream::setState().
|
protected |
Definition at line 231 of file IOstream.H.
Referenced by ISstream::get(), and IOstream::lineNumber().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.