mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: imbue input streams with label/scalar sizes (#1378)
This commit is contained in:
committed by
Andrew Heather
parent
d25b19f6aa
commit
2f983f3f6f
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user