IOstreamOption Class Reference

The IOstreamOption is a simple container for options an IOstream can normally have. More...

Inheritance diagram for IOstreamOption:
[legend]
Collaboration diagram for IOstreamOption:
[legend]

Classes

class  versionNumber
 Representation of a major/minor version number. More...
 

Public Types

enum  streamFormat : char { ASCII = 0, BINARY }
 Data format (ascii | binary) More...
 
enum  compressionType : char { UNCOMPRESSED = 0, COMPRESSED }
 Compression treatment (UNCOMPRESSED | COMPRESSED) More...
 

Public Member Functions

constexpr IOstreamOption (streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
 
constexpr IOstreamOption (streamFormat fmt, compressionType comp, versionNumber ver) noexcept
 Construct from components (format, compression, version) More...
 
constexpr IOstreamOption (streamFormat fmt, versionNumber ver, compressionType comp=compressionType::UNCOMPRESSED) noexcept
 Construct from components (format, version, compression) More...
 
 IOstreamOption (const IOstreamOption &opt, streamFormat fmt) noexcept
 Copy construct with change of format. More...
 
streamFormat format () const noexcept
 Get the current stream format. More...
 
streamFormat format (const streamFormat fmt) noexcept
 Set the stream format. More...
 
streamFormat format (const word &formatName)
 Set the stream format from string value. More...
 
compressionType compression () const noexcept
 Get the stream compression. More...
 
compressionType compression (const compressionType comp) noexcept
 Set the stream compression. More...
 
compressionType compression (const word &compName)
 Set the stream compression from string value. More...
 
versionNumber version () const noexcept
 Get the stream version. More...
 
versionNumber version (const versionNumber ver) noexcept
 Set the stream version. More...
 
versionNumber version (const token &tok)
 Set the stream version from token. More...
 

Static Public Member Functions

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)
 Failsafe construct streamFormat from optional dictionary lookup. More...
 
static compressionType compressionEnum (const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED)
 The compression enum corresponding to the string. More...
 
static compressionType compressionEnum (const word &key, const dictionary &dict, const compressionType deflt=compressionType::UNCOMPRESSED)
 Failsafe construct compressionType from optional dictionary lookup. More...
 

Static Public Attributes

static const Enum< streamFormatformatNames
 Stream format names (ascii, binary) More...
 
static const versionNumber currentVersion
 The current version number (2.0) More...
 

Detailed Description

The IOstreamOption is a simple container for options an IOstream can normally have.

The format (ASCII | BINARY) is typically controlled by enumerated names (ascii, binary).

The compression (UNCOMPRESSED | COMPRESSED) is typically controlled by switch values (true/false, on/off, ...).

Source files

Definition at line 63 of file IOstreamOption.H.

Member Enumeration Documentation

◆ streamFormat

enum streamFormat : char

Data format (ascii | binary)

Enumerator
ASCII 

"ascii" (normal default)

BINARY 

"binary"

Definition at line 70 of file IOstreamOption.H.

◆ compressionType

enum compressionType : char

Compression treatment (UNCOMPRESSED | COMPRESSED)

Enumerator
UNCOMPRESSED 

compression = false

COMPRESSED 

compression = true

Definition at line 77 of file IOstreamOption.H.

Constructor & Destructor Documentation

◆ IOstreamOption() [1/4]

constexpr IOstreamOption ( streamFormat  fmt = streamFormat::ASCII,
compressionType  comp = compressionType::UNCOMPRESSED 
)
inlineconstexprnoexcept

Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression

Note
non-explicit for convenient construction

Definition at line 193 of file IOstreamOption.H.

Referenced by threadedCollatedOFstream::~threadedCollatedOFstream().

Here is the caller graph for this function:

◆ IOstreamOption() [2/4]

constexpr IOstreamOption ( streamFormat  fmt,
compressionType  comp,
versionNumber  ver 
)
inlineconstexprnoexcept

Construct from components (format, compression, version)

Definition at line 205 of file IOstreamOption.H.

◆ IOstreamOption() [3/4]

constexpr IOstreamOption ( streamFormat  fmt,
versionNumber  ver,
compressionType  comp = compressionType::UNCOMPRESSED 
)
inlineconstexprnoexcept

Construct from components (format, version, compression)

Definition at line 218 of file IOstreamOption.H.

◆ IOstreamOption() [4/4]

IOstreamOption ( const IOstreamOption opt,
streamFormat  fmt 
)
inlinenoexcept

Copy construct with change of format.

Definition at line 230 of file IOstreamOption.H.

Member Function Documentation

◆ formatEnum() [1/2]

Foam::IOstreamOption::streamFormat formatEnum ( const word formatName,
const streamFormat  deflt = streamFormat::ASCII 
)
static

The stream format enum corresponding to the string (ascii | binary).

If the string is not recognized, emit warning and return default. Silent if the string itself is empty.

Note
Can be used as constructor substitute for the enumeration

Definition at line 53 of file IOstreamOption.C.

References WarningInFunction.

Referenced by vtkCloud::read(), vtkWrite::read(), and vtkWriter::vtkWriter().

Here is the caller graph for this function:

◆ formatEnum() [2/2]

Foam::IOstreamOption::streamFormat formatEnum ( const word key,
const dictionary dict,
const streamFormat  deflt = streamFormat::ASCII 
)
static

Failsafe construct streamFormat from optional dictionary lookup.

Parameters
keyLookup key. Uses LITERAL (not REGEX)
dictdictionary

Definition at line 80 of file IOstreamOption.C.

References dict, and Foam::glTF::key().

Here is the call graph for this function:

◆ compressionEnum() [1/2]

Foam::IOstreamOption::compressionType compressionEnum ( const word compName,
const compressionType  deflt = compressionType::UNCOMPRESSED 
)
static

The compression enum corresponding to the string.

Expects switch values (true/false, on/off, ...)

If the string is not recognized, emit warning and return default. Silent if the string itself is empty.

Note
Can be used as constructor substitute for the enumeration

Definition at line 92 of file IOstreamOption.C.

References Foam::ListOps::find(), Switch::good(), Foam::nl, and WarningInFunction.

Here is the call graph for this function:

◆ compressionEnum() [2/2]

Foam::IOstreamOption::compressionType compressionEnum ( const word key,
const dictionary dict,
const compressionType  deflt = compressionType::UNCOMPRESSED 
)
static

Failsafe construct compressionType from optional dictionary lookup.

Parameters
keyLookup key. Uses LITERAL (not REGEX)
dictdictionary

Definition at line 127 of file IOstreamOption.C.

References dict, and Foam::glTF::key().

Here is the call graph for this function:

◆ format() [1/3]

streamFormat format ( ) const
inlinenoexcept

Get the current stream format.

Definition at line 286 of file IOstreamOption.H.

Referenced by CollidingParcel< ParcelType >::CollidingParcel(), DSMCParcel< ParcelType >::DSMCParcel(), codeStream::evaluate(), findCellParticle::findCellParticle(), FIRECore::getFireLabel(), FIRECore::getFirePoint(), FIRECore::getFireString(), injectedParticle::injectedParticle(), KinematicParcel< ParcelType >::KinematicParcel(), molecule::molecule(), MPPICParcel< ParcelType >::MPPICParcel(), Foam::operator<<(), Foam::operator>>(), IOobject::parseHeader(), particle< Type >::particle(), Foam::processFlags(), ReactingParcel< ParcelType >::ReactingParcel(), ensightReadFile::read(), decomposedBlockData::readBlock(), exprResultGlobals::readData(), Time::readDict(), IOobject::readHeader(), List< vectorField >::readList(), PackedList< 2 >::readList(), FixedList< Type, 3 >::readList(), UList< Foam::wordRe >::readList(), Matrix< RectangularMatrix< Type >, Type >::readMatrix(), Foam::setformat(), solidParticle::solidParticle(), SprayParcel< ParcelType >::SprayParcel(), ThermoParcel< ParcelType >::ThermoParcel(), trackedParticle::trackedParticle(), wallBoundedParticle::wallBoundedParticle(), OBJsurfaceFormat< Face >::write(), X3DsurfaceFormat< Face >::write(), SMESHsurfaceFormat< Face >::write(), AC3DsurfaceFormat< Face >::write(), OFFsurfaceFormat< Face >::write(), GTSsurfaceFormat< Face >::write(), OBJedgeFormat::write(), TRIsurfaceFormat< Face >::write(), ABAQUSsurfaceFormat< Face >::write(), STARCDsurfaceFormat< Face >::write(), NASsurfaceFormat< Face >::write(), STARCDedgeFormat::write(), csvTableReader< Type >::write(), STLsurfaceFormat< Face >::write(), dimensionSet::write(), Foam::writeChars(), decomposedBlockData::writeData(), decomposedBlockData::writeExtraHeaderContent(), Time::writeFormat(), decomposedBlockData::writeHeader(), IOobject::writeHeaderContent(), CompactIOField< T, BaseType >::writeObject(), CompactIOList< face, label >::writeObject(), rigidBodyMeshMotionSolver::writeObject(), rigidBodyMeshMotion::writeObject(), distributedTriSurfaceMesh::writeObject(), injectedParticle::writePosition(), and particle< Type >::writePosition().

◆ format() [2/3]

streamFormat format ( const streamFormat  fmt)
inlinenoexcept

Set the stream format.

Returns
the previous value

Definition at line 293 of file IOstreamOption.H.

◆ format() [3/3]

streamFormat format ( const word formatName)
inline

Set the stream format from string value.

If the string is not recognized, emit warning and leave unchanged. Silent if the string itself is empty.

Returns
the previous value

Definition at line 304 of file IOstreamOption.H.

◆ compression() [1/3]

compressionType compression ( ) const
inlinenoexcept

Get the stream compression.

Definition at line 312 of file IOstreamOption.H.

Referenced by masterUncollatedFileOperation::readAndSend(), Time::readDict(), STLsurfaceFormat< Face >::write(), Time::writeCompression(), and polyBoundaryMesh::writeObject().

Here is the caller graph for this function:

◆ compression() [2/3]

compressionType compression ( const compressionType  comp)
inlinenoexcept

Set the stream compression.

Returns
the previous value

Definition at line 319 of file IOstreamOption.H.

◆ compression() [3/3]

compressionType compression ( const word compName)
inline

Set the stream compression from string value.

If the string is not recognized, emit warning and leave unchanged. Silent if the string itself is empty.

Returns
the previous value

Definition at line 330 of file IOstreamOption.H.

◆ version() [1/3]

versionNumber version ( ) const
inlinenoexcept

Get the stream version.

Definition at line 338 of file IOstreamOption.H.

Referenced by collatedFileOperation::appendObject(), IOobject::parseHeader(), decomposedBlockData::readBlock(), Time::readDict(), IOobject::readHeader(), Foam::setversion(), decomposedBlockData::writeData(), IOobject::writeHeaderContent(), Time::writeVersion(), and threadedCollatedOFstream::~threadedCollatedOFstream().

Here is the caller graph for this function:

◆ version() [2/3]

versionNumber version ( const versionNumber  ver)
inlinenoexcept

Set the stream version.

Returns
the previous value

Definition at line 345 of file IOstreamOption.H.

◆ version() [3/3]

versionNumber version ( const token tok)
inline

Set the stream version from token.

Returns
the previous value

Definition at line 354 of file IOstreamOption.H.

Member Data Documentation

◆ formatNames

const Foam::Enum< Foam::IOstreamOption::streamFormat > formatNames
static

Stream format names (ascii, binary)

Definition at line 162 of file IOstreamOption.H.

Referenced by Foam::operator<<(), exprResult::writeDict(), exprResult::writeField(), and exprResult::writeValue().

◆ currentVersion

const Foam::IOstreamOption::versionNumber currentVersion
static

The current version number (2.0)

Definition at line 165 of file IOstreamOption.H.

Referenced by FIREMeshWriter::write().


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