Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
IOstream Class Referenceabstract

An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc. More...

Inheritance diagram for IOstream:
Inheritance graph
[legend]
Collaboration diagram for IOstream:
Collaboration graph
[legend]

Public Types

enum  streamAccess : char { CLOSED = 0, OPENED }
 
- Public Types inherited from IOstreamOption
enum  streamFormat : char { ASCII = 0, BINARY }
 
enum  compressionType : char { UNCOMPRESSED = 0, COMPRESSED }
 

Public Member Functions

 IOstream (const IOstream &)=default
 
virtual ~IOstream ()=default
 
 IOstream (IOstreamOption streamOpt=IOstreamOption())
 
 IOstream (IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
 
virtual const fileNamename () const
 
virtual fileNamename ()
 
fileName relativeName () const
 
virtual bool check (const char *operation) const
 
bool fatalCheck (const char *operation) const
 
bool opened () const noexcept
 
bool closed () const noexcept
 
bool good () const noexcept
 
bool eof () const noexcept
 
bool fail () const noexcept
 
bool bad () const noexcept
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 
unsigned labelByteSize () const noexcept
 
unsigned scalarByteSize () const noexcept
 
void setLabelByteSize (unsigned nbytes) noexcept
 
void setScalarByteSize (unsigned nbytes) noexcept
 
template<class T = label>
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize () const noexcept
 
template<class T = scalar>
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize () const noexcept
 
label lineNumber () const noexcept
 
label & lineNumber () noexcept
 
label lineNumber (const label num) noexcept
 
virtual ios_base::fmtflags flags () const =0
 
void setEof () noexcept
 
void setFail () noexcept
 
void setBad ()
 
virtual ios_base::fmtflags flags (const ios_base::fmtflags f)=0
 
ios_base::fmtflags setf (const ios_base::fmtflags f)
 
ios_base::fmtflags setf (const ios_base::fmtflags f, const ios_base::fmtflags mask)
 
void unsetf (const ios_base::fmtflags f)
 
virtual void print (Ostream &os) const
 
void print (Ostream &os, const int streamState) const
 
InfoProxy< IOstreaminfo () const
 
- Public Member Functions inherited from IOstreamOption
constexpr IOstreamOption (streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
 
constexpr IOstreamOption (streamFormat fmt, compressionType comp, versionNumber ver) noexcept
 
constexpr IOstreamOption (streamFormat fmt, versionNumber ver, compressionType comp=compressionType::UNCOMPRESSED) noexcept
 
 IOstreamOption (const IOstreamOption &opt, streamFormat fmt) noexcept
 
streamFormat format () const noexcept
 
streamFormat format (const streamFormat fmt) noexcept
 
streamFormat format (const word &formatName)
 
compressionType compression () const noexcept
 
compressionType compression (const compressionType comp) noexcept
 
compressionType compression (const word &compName)
 
versionNumber version () const noexcept
 
versionNumber version (const versionNumber ver) noexcept
 
versionNumber version (const token &tok)
 

Static Public Member Functions

static unsigned int defaultPrecision () noexcept
 
static unsigned int defaultPrecision (unsigned int prec) noexcept
 
- Static Public Member Functions inherited from IOstreamOption
static streamFormat formatEnum (const word &formatName, const streamFormat deflt=streamFormat::ASCII)
 
static streamFormat formatEnum (const word &key, const dictionary &dict, const streamFormat deflt=streamFormat::ASCII)
 
static compressionType compressionEnum (const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED)
 
static compressionType compressionEnum (const word &key, const dictionary &dict, const compressionType deflt=compressionType::UNCOMPRESSED)
 

Static Public Attributes

static unsigned int precision_
 
- Static Public Attributes inherited from IOstreamOption
static const Enum< streamFormatformatNames
 
static const versionNumber currentVersion
 

Protected Member Functions

void setOpened () noexcept
 
void setClosed () noexcept
 
void setState (std::ios_base::iostate state) noexcept
 
void setGood () noexcept
 

Protected Attributes

std::ios_base::iostate ioState_
 
streamAccess openClosed_
 
unsigned char sizeofLabel_
 
unsigned char sizeofScalar_
 
label lineNumber_
 

Static Protected Attributes

static fileName staticName_
 

Detailed Description

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.

Source files

Definition at line 75 of file IOstream.H.

Member Enumeration Documentation

◆ streamAccess

enum streamAccess : char
Enumerator
CLOSED 

The stream is not open.

OPENED 

The stream is open.

Definition at line 84 of file IOstream.H.

Constructor & Destructor Documentation

◆ IOstream() [1/3]

IOstream ( const IOstream )
default

◆ ~IOstream()

virtual ~IOstream ( )
virtualdefault

◆ IOstream() [2/3]

IOstream ( IOstreamOption  streamOpt = IOstreamOption())
inlineexplicit

Definition at line 164 of file IOstream.H.

References IOstream::setBad().

Here is the call graph for this function:

◆ IOstream() [3/3]

Definition at line 178 of file IOstream.H.

Member Function Documentation

◆ setOpened()

void setOpened ( )
inlineprotectednoexcept

Definition at line 125 of file IOstream.H.

References IOstream::openClosed_, and IOstream::OPENED.

Referenced by ITstream::ITstream(), OTstream::OTstream(), OTstream::rewind(), and UOPstream::UOPstream().

Here is the caller graph for this function:

◆ setClosed()

void setClosed ( )
inlineprotectednoexcept

Definition at line 131 of file IOstream.H.

References IOstream::CLOSED, and IOstream::openClosed_.

◆ setState()

void setState ( std::ios_base::iostate  state)
inlineprotectednoexcept

Definition at line 137 of file IOstream.H.

References IOstream::ioState_.

Referenced by ISstream::get().

Here is the caller graph for this function:

◆ setGood()

void setGood ( )
inlineprotectednoexcept

◆ name() [1/2]

Foam::fileName & name ( ) const
virtual

◆ name() [2/2]

virtual fileName& name ( )
virtual

Reimplemented in ITstream, primitiveEntry, ISstream, and OSstream.

◆ relativeName()

Foam::fileName relativeName ( ) const

Definition at line 45 of file IOstream.C.

References argList::envRelativePath(), and Foam::name().

Referenced by functionEntry::execute(), decomposedBlockData::readBlock(), decomposedBlockData::readBlocks(), IOobject::readHeader(), primitiveEntry::relativeName(), entry::reportReadWarning(), and IOerror::SafeFatalIOError().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check()

bool check ( const char *  operation) const
virtual

Definition at line 51 of file IOstream.C.

Referenced by CollisionRecordList< vector, vector >::CollisionRecordList(), eddy::eddy(), faBoundaryMesh::faBoundaryMesh(), findCellParticle::findCellParticle(), ignitionSite::ignitionSite(), injectedParticle::injectedParticle(), Foam::input(), kinematicParcelInjectionData::kinematicParcelInjectionData(), molecule::molecule(), objectMap::objectMap(), Foam::operator<<(), Foam::operator>>(), Foam::RBD::operator>>(), Foam::functionObjects::operator>>(), orientedType::orientedType(), Foam::output(), particle< Type >::particle(), polyBoundaryMesh::polyBoundaryMesh(), pyramid::pyramid(), reactingMultiphaseParcelInjectionData::reactingMultiphaseParcelInjectionData(), reactingParcelInjectionData::reactingParcelInjectionData(), SHA1Digest::read(), dimensionSet::read(), dimensioned< Type >::read(), IOPosition::readData(), lumpedPointIOMovement::readData(), PackedList< 2 >::setPair(), solidParticle::solidParticle(), streamLineParticle::streamLineParticle(), surfZoneIOList::surfZoneIOList(), thermoParcelInjectionData::thermoParcelInjectionData(), trackedParticle::trackedParticle(), VectorSpace< Vector< vector >, vector, 3 >::VectorSpace(), wallBoundedParticle::wallBoundedParticle(), wallBoundedStreamLineParticle::wallBoundedStreamLineParticle(), SHA1Digest::write(), dimensionSet::write(), Foam::writeChars(), faBoundaryMesh::writeData(), polyBoundaryMesh::writeData(), injectedParticle::writePosition(), and particle< Type >::writePosition().

Here is the caller graph for this function:

◆ fatalCheck()

bool fatalCheck ( const char *  operation) const

◆ opened()

bool opened ( ) const
inlinenoexcept

Definition at line 217 of file IOstream.H.

References IOstream::openClosed_, and IOstream::OPENED.

Referenced by meshRefinement::findRegions(), and sampledSets::writeSampleFile().

Here is the caller graph for this function:

◆ closed()

bool closed ( ) const
inlinenoexcept

Definition at line 223 of file IOstream.H.

References IOstream::CLOSED, and IOstream::openClosed_.

◆ good()

bool good ( ) const
inlinenoexcept

Definition at line 229 of file IOstream.H.

References IOstream::ioState_.

Referenced by backwardDdtScheme< Type >::backwardDdtScheme(), topoSetSource::checkIs(), dynamicCode::copyAndFilter(), dynamicCode::copyOrCreateFiles(), writeFile::createFile(), dynamicCode::createMakeFiles(), dynamicCode::createMakeOptions(), AC3DsurfaceFormatCore::cueTo(), directionalPressureGradientExplicitSource::directionalPressureGradientExplicitSource(), ensightSurfaceReader::geometry(), ISstream::get(), edgeMeshFormatsCore::getLineNoComment(), surfaceFormatsCore::getLineNoComment(), meanVelocityForce::meanVelocityForce(), csvTableReader< Type >::operator()(), rawIOField< Type >::rawIOField(), extendedEdgeMeshFormat::read(), VTKedgeFormat::read(), extendedFeatureEdgeMeshFormat::read(), OBJsurfaceFormat< Face >::read(), NASedgeFormat::read(), OFFsurfaceFormat< Face >::read(), OBJedgeFormat::read(), edgeMeshFormat::read(), ABAQUSsurfaceFormat< Face >::read(), AC3DsurfaceFormat< Face >::read(), tabulated6DoFAcceleration::read(), GTSsurfaceFormat< Face >::read(), STARCDsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), tabulated6DoFMotion::read(), STARCDedgeFormat::read(), VTKsurfaceFormat< Face >::read(), ABAQUSCore::readHelper::read(), dictionary::read(), masterUncollatedFileOperation::readAndSend(), decomposedBlockData::readBlocks(), STARCDMeshReader::readBoundary(), ensightSurfaceReader::readCase(), STARCDMeshReader::readCells(), AC3DsurfaceFormatCore::readCmd(), UniformDimensionedField< vector >::readData(), GlobalIOList< kinematicParcelInjectionData >::readData(), GlobalIOField< vector >::readData(), ensightSurfaceReader::readField(), STARCDCore::readHeader(), IOobject::readHeader(), masterUncollatedFileOperation::readHeader(), STARCDsurfaceFormatCore::readInpCellTable(), ensightSurfaceReader::readLine(), STARCDMeshReader::readPoints(), STARCDCore::readPoints(), noiseFFT::setData(), Reaction::setLRhs(), ensightSurfaceReader::skip(), TableFile< Type >::TableFile(), graph::write(), featureEdgeMesh::writeData(), rawIOField< Type >::writeData(), lumpedPointIOMovement::writeData(), baseIOdictionary::writeData(), porosityModelList::writeData(), extendedFeatureEdgeMesh::writeData(), virtualMassModel::writeData(), polyTopoChanger::writeData(), dragModel::writeData(), coordinateSystems::writeData(), decomposedBlockData::writeData(), MRFZoneList::writeData(), faBoundaryMesh::writeData(), profiling::writeData(), polyBoundaryMesh::writeData(), refinementHistory::writeData(), dynamicCode::writeDigest(), dictionary::writeEntries(), IOobject::writeHeader(), Foam::writeJobDict(), and fileOperation::writeObject().

◆ eof()

bool eof ( ) const
inlinenoexcept

◆ fail()

bool fail ( ) const
inlinenoexcept

Definition at line 241 of file IOstream.H.

References IOstream::ioState_.

Referenced by IOstream::operator bool(), and IOstream::operator!().

Here is the caller graph for this function:

◆ bad()

bool bad ( ) const
inlinenoexcept

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

Definition at line 253 of file IOstream.H.

References IOstream::fail().

Here is the call graph for this function:

◆ operator!()

bool operator! ( ) const
inlinenoexcept

Definition at line 259 of file IOstream.H.

References IOstream::fail().

Here is the call graph for this function:

◆ labelByteSize()

unsigned labelByteSize ( ) const
inlinenoexcept

Definition at line 268 of file IOstream.H.

References IOstream::sizeofLabel_.

Referenced by decomposedBlockData::readBlock().

Here is the caller graph for this function:

◆ scalarByteSize()

unsigned scalarByteSize ( ) const
inlinenoexcept

Definition at line 274 of file IOstream.H.

References IOstream::sizeofScalar_.

Referenced by decomposedBlockData::readBlock().

Here is the caller graph for this function:

◆ setLabelByteSize()

void setLabelByteSize ( unsigned  nbytes)
inlinenoexcept

Definition at line 280 of file IOstream.H.

References IOstream::sizeofLabel_.

Referenced by IOobject::readHeader().

Here is the caller graph for this function:

◆ setScalarByteSize()

void setScalarByteSize ( unsigned  nbytes)
inlinenoexcept

Definition at line 286 of file IOstream.H.

References IOstream::sizeofScalar_.

Referenced by IOobject::readHeader().

Here is the caller graph for this function:

◆ checkLabelSize()

std::enable_if<std::is_integral<T>::value, bool>::type checkLabelSize ( ) const
inlinenoexcept

◆ checkScalarSize()

std::enable_if<std::is_floating_point<T>::value, bool>::type checkScalarSize ( ) const
inlinenoexcept

◆ lineNumber() [1/3]

label lineNumber ( ) const
inlinenoexcept

◆ lineNumber() [2/3]

label& lineNumber ( )
inlinenoexcept

Definition at line 320 of file IOstream.H.

References IOstream::lineNumber_.

◆ lineNumber() [3/3]

label lineNumber ( const label  num)
inlinenoexcept

Definition at line 327 of file IOstream.H.

References IOstream::lineNumber_.

◆ flags() [1/2]

virtual ios_base::fmtflags flags ( ) const
pure virtual

Implemented in ITstream, OTstream, dummyISstream, UOPstream, UIPstream, ISstream, and OSstream.

Referenced by IOstream::setf(), and IOstream::unsetf().

Here is the caller graph for this function:

◆ defaultPrecision() [1/2]

static unsigned int defaultPrecision ( )
inlinestaticnoexcept

◆ defaultPrecision() [2/2]

static unsigned int defaultPrecision ( unsigned int  prec)
inlinestaticnoexcept

Definition at line 345 of file IOstream.H.

References IOstream::precision_.

◆ setEof()

void setEof ( )
inlinenoexcept

Definition at line 353 of file IOstream.H.

References IOstream::ioState_.

◆ setFail()

void setFail ( )
inlinenoexcept

Definition at line 359 of file IOstream.H.

References IOstream::ioState_.

◆ setBad()

void setBad ( )
inline

Definition at line 365 of file IOstream.H.

References IOstream::ioState_.

Referenced by IOstream::IOstream(), and Foam::operator>>().

Here is the caller graph for this function:

◆ flags() [2/2]

virtual ios_base::fmtflags flags ( const ios_base::fmtflags  f)
pure virtual

◆ setf() [1/2]

ios_base::fmtflags setf ( const ios_base::fmtflags  f)
inline

Definition at line 374 of file IOstream.H.

References f(), and IOstream::flags().

Referenced by Foam::dec(), Foam::fixed(), Foam::hex(), Foam::oct(), Foam::scientific(), Foam::setf(), ensightSetWriter< Type >::write(), ensightWriter::writeCollated(), and ensightWriter::writeUncollated().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setf() [2/2]

ios_base::fmtflags setf ( const ios_base::fmtflags  f,
const ios_base::fmtflags  mask 
)
inline

Definition at line 381 of file IOstream.H.

References f(), and IOstream::flags().

Here is the call graph for this function:

◆ unsetf()

void unsetf ( const ios_base::fmtflags  f)
inline

Definition at line 390 of file IOstream.H.

References f(), and IOstream::flags().

Here is the call graph for this function:

◆ print() [1/2]

void print ( Ostream os) const
virtual

Reimplemented in OListStream, ITstream, OCountStream, OStringStream, UOPstream, UIListStream, UOListStream, OTstream, OSstream, ISstream, UIPstream, IListStream, IStringStream, prefixOSstream, OFstream, and IFstream.

Definition at line 73 of file IOstream.C.

References Foam::endl(), format(), os(), and Foam::foamVersion::version.

Referenced by ISstream::print(), OSstream::print(), OTstream::print(), ITstream::print(), and HashTable::Iterator< true >::print().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print() [2/2]

void print ( Ostream os,
const int  streamState 
) const

Definition at line 112 of file IOstream.C.

References Foam::endl(), and os().

Here is the call graph for this function:

◆ info()

InfoProxy<IOstream> info ( ) const
inline

Definition at line 409 of file IOstream.H.

Referenced by MultiInteraction< CloudType >::info(), dimensionSet::read(), and IOobject::writeHeader().

Here is the caller graph for this function:

Member Data Documentation

◆ precision_

unsigned int precision_
static

Definition at line 94 of file IOstream.H.

Referenced by IOstream::defaultPrecision(), and functionObjectList::execute().

◆ staticName_

Foam::fileName staticName_
staticprotected

Definition at line 102 of file IOstream.H.

Referenced by IOstream::name().

◆ ioState_

std::ios_base::iostate ioState_
protected

◆ openClosed_

streamAccess openClosed_
protected

◆ sizeofLabel_

unsigned char sizeofLabel_
protected

◆ sizeofScalar_

unsigned char sizeofScalar_
protected

◆ lineNumber_

label lineNumber_
protected

Definition at line 117 of file IOstream.H.

Referenced by ISstream::get(), and IOstream::lineNumber().


The documentation for this class was generated from the following files: