A simple container for options an IOstream can normally have. More...
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... | |
enum | appendType : char { NON_APPEND = 0, APPEND } |
File appending (NON_APPEND | APPEND) More... | |
enum | atomicType : char { NON_ATOMIC = 0, ATOMIC } |
Atomic operations (output) More... | |
Public Member Functions | |
constexpr | IOstreamOption (streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept |
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression. More... | |
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) |
The stream format enum corresponding to the string (ascii | binary). More... | |
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< streamFormat > | formatNames |
Stream format names (ascii, binary) More... | |
static const versionNumber | currentVersion |
The current version number (2.0) More... | |
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, ...).
Additionally, some enumerations are defined (APPEND, NON_APPEND, ...) that are useful, verbose alternatives to bool values.
Definition at line 61 of file IOstreamOption.H.
enum streamFormat : char |
Data format (ascii | binary)
Enumerator | |
---|---|
ASCII | "ascii" (normal default) |
BINARY | "binary" |
Definition at line 70 of file IOstreamOption.H.
enum compressionType : char |
Compression treatment (UNCOMPRESSED | COMPRESSED)
Enumerator | |
---|---|
UNCOMPRESSED | compression = false |
COMPRESSED | compression = true |
Definition at line 79 of file IOstreamOption.H.
enum appendType : char |
File appending (NON_APPEND | APPEND)
Enumerator | |
---|---|
NON_APPEND | append = false |
APPEND | append = true |
Definition at line 88 of file IOstreamOption.H.
enum atomicType : char |
Atomic operations (output)
Enumerator | |
---|---|
NON_ATOMIC | atomic = false |
ATOMIC | atomic = true |
Definition at line 97 of file IOstreamOption.H.
|
inlinenoexcept |
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression.
Definition at line 251 of file IOstreamOption.H.
Referenced by threadedCollatedOFstream::~threadedCollatedOFstream().
|
inlinenoexcept |
Construct from components (format, compression, version)
Definition at line 265 of file IOstreamOption.H.
|
inlinenoexcept |
Construct from components (format, version, compression)
Definition at line 280 of file IOstreamOption.H.
|
inlinenoexcept |
Copy construct with change of format.
Definition at line 294 of file IOstreamOption.H.
|
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.
Definition at line 46 of file IOstreamOption.C.
References WarningInFunction.
Referenced by IOstreamOption::format(), vtkCloud::read(), vtkWrite::read(), and vtkWriter::vtkWriter().
|
static |
Failsafe construct streamFormat from optional dictionary lookup.
key | Lookup key. Uses LITERAL (not REGEX) |
dict | dictionary |
Definition at line 73 of file IOstreamOption.C.
References dict, and Foam::glTF::key().
|
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.
Definition at line 85 of file IOstreamOption.C.
References Foam::ListOps::find(), Switch::good(), Foam::nl, and WarningInFunction.
Referenced by IOstreamOption::compression().
|
static |
Failsafe construct compressionType from optional dictionary lookup.
key | Lookup key. Uses LITERAL (not REGEX) |
dict | dictionary |
Definition at line 120 of file IOstreamOption.C.
References dict, and Foam::glTF::key().
|
inlinenoexcept |
Get the current stream format.
Definition at line 362 of file IOstreamOption.H.
Referenced by CollidingParcel< ParcelType >::CollidingParcel(), DSMCParcel< ParcelType >::DSMCParcel(), codeStream::evaluate(), findCellParticle::findCellParticle(), FIRECore::getFireLabel(), FIRECore::getFirePoint(), FIRECore::getFireString(), decomposedBlockData::getNumBlocks(), injectedParticle::injectedParticle(), KinematicParcel< ParcelType >::KinematicParcel(), molecule::molecule(), MPPICParcel< ParcelType >::MPPICParcel(), Foam::operator<<(), Foam::operator>>(), IOobject::parseHeader(), Foam::printMaps(), Foam::processFlags(), ReactingParcel< ParcelType >::ReactingParcel(), decomposedBlockData::readBlock(), exprResultGlobals::readData(), particle< Type >::readData(), Time::readDict(), ensightSurfaceReader::readGeometry(), IOobject::readHeader(), List< Field< scalar > >::readList(), PackedList< 2 >::readList(), FixedList< point, 2 >::readList(), UList< Foam::vector >::readList(), Matrix< RectangularMatrix< Type >, Type >::readMatrix(), Foam::setformat(), decomposedBlockData::skipBlockEntry(), solidParticle::solidParticle(), SprayParcel< ParcelType >::SprayParcel(), ThermoParcel< ParcelType >::ThermoParcel(), trackedParticle::trackedParticle(), wallBoundedParticle::wallBoundedParticle(), X3DsurfaceFormat< Face >::write(), OBJsurfaceFormat< Face >::write(), SMESHsurfaceFormat< Face >::write(), AC3DsurfaceFormat< Face >::write(), OFFsurfaceFormat< Face >::write(), GTSsurfaceFormat< Face >::write(), TRIsurfaceFormat< Face >::write(), STARCDsurfaceFormat< Face >::write(), OBJedgeFormat::write(), ABAQUSsurfaceFormat< Face >::write(), NASsurfaceFormat< Face >::write(), STARCDedgeFormat::write(), FIREMeshWriter::write(), csvTableReader< Type >::write(), STLsurfaceFormat< Face >::write(), dimensionSet::write(), Foam::writeChars(), decomposedBlockData::writeData(), decomposedBlockData::writeExtraHeaderContent(), Time::writeFormat(), decomposedBlockData::writeHeader(), IOobject::writeHeaderContent(), Foam::writeMaps(), CompactIOField< T, BaseType >::writeObject(), CompactIOList< face, label >::writeObject(), rigidBodyMeshMotionSolver::writeObject(), rigidBodyMeshMotion::writeObject(), distributedTriSurfaceMesh::writeObject(), injectedParticle::writePosition(), and particle< Type >::writePosition().
|
inlinenoexcept |
|
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.
Definition at line 383 of file IOstreamOption.H.
References IOstreamOption::formatEnum().
|
inlinenoexcept |
Get the stream compression.
Definition at line 393 of file IOstreamOption.H.
Referenced by masterUncollatedFileOperation::readAndSend(), Time::readDict(), FIREMeshWriter::write(), STLsurfaceFormat< Face >::write(), Time::writeCompression(), and polyBoundaryMesh::writeObject().
|
inlinenoexcept |
Set the stream compression.
Definition at line 400 of file IOstreamOption.H.
|
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.
Definition at line 414 of file IOstreamOption.H.
References IOstreamOption::compressionEnum().
|
inlinenoexcept |
Get the stream version.
Definition at line 424 of file IOstreamOption.H.
Referenced by collatedFileOperation::appendObject(), decomposedBlockData::getNumBlocks(), IOobject::parseHeader(), decomposedBlockData::readBlock(), Time::readDict(), IOobject::readHeader(), Foam::setversion(), decomposedBlockData::writeData(), IOobject::writeHeaderContent(), Time::writeVersion(), and threadedCollatedOFstream::~threadedCollatedOFstream().
|
inlinenoexcept |
|
inline |
Set the stream version from token.
Definition at line 443 of file IOstreamOption.H.
|
static |
Stream format names (ascii, binary)
Definition at line 209 of file IOstreamOption.H.
Referenced by Foam::operator<<(), ensightSurfaceReader::readGeometry(), exprResult::writeDict(), exprResult::writeField(), and exprResult::writeValue().
|
static |
The current version number (2.0)
Definition at line 214 of file IOstreamOption.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.