Commit 2f983f3f authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

ENH: imbue input streams with label/scalar sizes (#1378)

parent d25b19f6
......@@ -108,6 +108,9 @@ bool Foam::IOobject::readHeader(Istream& is)
val = foamVersion::scalarByteSize(arch);
if (val) scalarByteSize_ = val;
}
is.setLabelByteSize(labelByteSize_);
is.setScalarByteSize(scalarByteSize_);
}
else
{
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -69,6 +69,12 @@ class Istream
//- The last token put back on the stream
token putBackToken_;
//- The label byte-size (could also be stored as byte)
unsigned short labelByteSize_;
//- The scalar byte-size (could also be stored as byte)
unsigned short scalarByteSize_;
public:
......@@ -83,7 +89,9 @@ public:
)
:
IOstream(format, version, compression),
putBack_(false)
putBack_(false),
labelByteSize_(sizeof(Foam::label)),
scalarByteSize_(sizeof(Foam::scalar))
{}
......@@ -91,7 +99,34 @@ public:
virtual ~Istream() = default;
// Member functions
// Member Functions
// Characteristics
//- The label byte-size associated with the stream
inline unsigned labelByteSize() const
{
return labelByteSize_;
}
//- The scalar byte-size associated with the stream
inline unsigned scalarByteSize() const
{
return scalarByteSize_;
}
//- Associate a label byte-size with the stream
inline void setLabelByteSize(unsigned val)
{
labelByteSize_ = val;
}
//- Associate a scalar byte-size with the stream
inline void setScalarByteSize(unsigned val)
{
scalarByteSize_ = val;
}
// Read functions
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment