diff --git a/applications/test/OListStream/Test-OListStream.C b/applications/test/OListStream/Test-OListStream.C index 59047bf723..ee89bfb1b9 100644 --- a/applications/test/OListStream/Test-OListStream.C +++ b/applications/test/OListStream/Test-OListStream.C @@ -73,6 +73,17 @@ void printTokens(Istream& is) } +// Generate some dictionary-like content +template +void outputDict(OS& os) +{ + os.beginBlock("testDict"); + os.writeEntry("bool", "false"); + os.writeEntry("scalar", 3.14159); + os.endBlock(); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -188,6 +199,28 @@ int main(int argc, char *argv[]) << "content size=" << written.size() << " capacity=" << written.capacity() << nl; + + Info<< nl << "Test dictionary" << nl; + { + OListStream os1; + + outputDict(os1); + + Info<< "Regular" << nl; + printInfo(os1); + } + + { + OListStream os2; + os2.indentSize() = 0; + + outputDict(os2); + + Info<< "Compact" << nl; + printInfo(os2); + } + + Info<< "\nEnd\n" << endl; return 0; diff --git a/applications/test/sizeof/Test-sizeof.C b/applications/test/sizeof/Test-sizeof.C index 9ad7e6e3cf..41a9e1dde8 100644 --- a/applications/test/sizeof/Test-sizeof.C +++ b/applications/test/sizeof/Test-sizeof.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2009-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011 OpenFOAM Foundation @@ -62,6 +62,19 @@ using namespace Foam; int main(int argc, char *argv[]) { cout<<"sizeof\n------\n"; + + if (true) + { + cout<<"IOstream:" << sizeof(IOstream) << nl; + cout<<"Istream:" << sizeof(Istream) << nl; + cout<<"IPstream:" << sizeof(IPstream) << nl; + cout<<"ISstream:" << sizeof(ISstream) << nl; + + cout<<"Ostream:" << sizeof(Ostream) << nl; + cout<<"OPstream:" << sizeof(OPstream) << nl; + cout<<"OSstream:" << sizeof(OSstream) << nl; + } + { nil x; cout<<"nil:" << sizeof(x) << nl; diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C index 0cc6df7e6e..e5e67578d2 100644 --- a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C +++ b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C @@ -102,7 +102,7 @@ Foam::Ostream& Foam::IndirectListBase::writeList { // The TOTAL number of bytes to be written. // - possibly add start delimiter - os.beginRaw(len*sizeof(T)); + os.beginRawWrite(len*sizeof(T)); // Contents for (label i=0; i < len; ++i) @@ -115,7 +115,7 @@ Foam::Ostream& Foam::IndirectListBase::writeList } // End delimiter and/or cleanup. - os.endRaw(); + os.endRawWrite(); } } diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index 390b8d212c..4d575871cf 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -298,8 +298,8 @@ Foam::IOobject::IOobject registerObject_(registerObject), globalObject_(false), objState_(GOOD), - labelByteSize_(sizeof(Foam::label)), - scalarByteSize_(sizeof(Foam::scalar)) + labelByteSize_(sizeof(label)), + scalarByteSize_(sizeof(scalar)) { if (objectRegistry::debug) { @@ -334,8 +334,8 @@ Foam::IOobject::IOobject registerObject_(registerObject), globalObject_(globalObject), objState_(GOOD), - labelByteSize_(sizeof(Foam::label)), - scalarByteSize_(sizeof(Foam::scalar)) + labelByteSize_(sizeof(label)), + scalarByteSize_(sizeof(scalar)) { if (objectRegistry::debug) { @@ -368,8 +368,8 @@ Foam::IOobject::IOobject registerObject_(registerObject), globalObject_(globalObject), objState_(GOOD), - labelByteSize_(sizeof(Foam::label)), - scalarByteSize_(sizeof(Foam::scalar)) + labelByteSize_(sizeof(label)), + scalarByteSize_(sizeof(scalar)) { if (!fileNameComponents(path, instance_, local_, name_)) { @@ -534,6 +534,8 @@ void Foam::IOobject::operator=(const IOobject& io) wOpt_ = io.wOpt_; globalObject_ = io.globalObject_; objState_ = io.objState_; + labelByteSize_ = io.labelByteSize_; + scalarByteSize_ = io.scalarByteSize_; } diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index 60be6238fd..6416105730 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -95,7 +95,6 @@ class objectRegistry; class IOobject { - public: // Public data types @@ -155,7 +154,7 @@ private: //- Local path component fileName local_; - //- objectRegistry reference + //- Reference to the objectRegistry const objectRegistry& db_; //- Read option @@ -230,7 +229,7 @@ public: static inline word groupName(StringType name, const word& group); - //- Return group (extension part of name) + //- Return group (extension part of name) static word group(const word& name); //- Return member (name without the extension) diff --git a/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C b/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C index 942ecab110..639fa1495d 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C +++ b/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C @@ -95,8 +95,8 @@ bool Foam::IOobject::readHeader(Istream& is) // The note entry is optional headerDict.readIfPresent("note", note_); - labelByteSize_ = sizeof(Foam::label); - scalarByteSize_ = sizeof(Foam::scalar); + labelByteSize_ = sizeof(label); + scalarByteSize_ = sizeof(scalar); // The arch information is optional string arch; diff --git a/src/OpenFOAM/db/IOstreams/IOstreams.C b/src/OpenFOAM/db/IOstreams/IOstreams.C index d6838ea181..8984de730b 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams.C +++ b/src/OpenFOAM/db/IOstreams/IOstreams.C @@ -23,6 +23,9 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +Note + File included by global/global.Cver + \*---------------------------------------------------------------------------*/ #include "IOstreamOption.H" diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/IOmanip.H b/src/OpenFOAM/db/IOstreams/IOstreams/IOmanip.H index b833a2b3ae..4982d29456 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/IOmanip.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/IOmanip.H @@ -2,10 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2019 OpenCFD Ltd. \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2011 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,7 +40,7 @@ Description namespace Foam { -// Forward declarations +// Forward Declarations template class Smanip; template class Imanip; @@ -65,6 +63,7 @@ inline Ostream& operator<<(Ostream& os, const Omanip& m); Class Smanip Declaration \*---------------------------------------------------------------------------*/ +//- An IOstream manipulator taking arguments template class Smanip { @@ -104,6 +103,7 @@ inline Ostream& operator<<(Ostream& os, const Smanip& m) Class Imanip Declaration \*---------------------------------------------------------------------------*/ +//- An Istream manipulator taking arguments template class Imanip { @@ -134,6 +134,7 @@ inline Istream& operator>>(Istream& is, const Imanip& m) Class Omanip Declaration \*---------------------------------------------------------------------------*/ +//- An Ostream manipulator taking arguments template class Omanip { diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H b/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H index 0f85130ea4..2b8e0fdeeb 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2015 OpenFOAM Foundation @@ -80,7 +80,7 @@ public: // Public Data Types - //- Enumeration for whether the stream open or closed + //- Enumeration for stream open/closed state enum streamAccess : char { CLOSED = 0, //!< stream not open @@ -105,6 +105,13 @@ protected: ios_base::iostate ioState_; + //- 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_; + + //- The file line label lineNumber_; @@ -147,12 +154,14 @@ public: IOstreamOption(option), openClosed_(CLOSED), ioState_(ios_base::iostate(0)), + labelByteSize_(sizeof(label)), + scalarByteSize_(sizeof(scalar)), lineNumber_(0) { setBad(); } - //- Construct setting format and version + //- Construct with format, version IOstream ( streamFormat format, @@ -242,6 +251,30 @@ public: // Stream State Functions + //- The label byte-size associated with the stream + unsigned labelByteSize() const + { + return labelByteSize_; + } + + //- The scalar byte-size associated with the stream + unsigned scalarByteSize() const + { + return scalarByteSize_; + } + + //- Set the label byte-size associated with the stream + void setLabelByteSize(unsigned nbytes) + { + labelByteSize_ = nbytes; + } + + //- Set the scalar byte-size associated with the stream + void setScalarByteSize(unsigned nbytes) + { + scalarByteSize_ = nbytes; + } + //- Const access to the current stream line number label lineNumber() const { @@ -258,7 +291,7 @@ public: // \return the previous value label lineNumber(const label num) { - label old(lineNumber_); + const label old(lineNumber_); lineNumber_ = num; return old; } @@ -345,7 +378,7 @@ public: }; -// Ostream operator +// Ostream Operator template<> Ostream& operator<<(Ostream& os, const InfoProxy& ip); @@ -355,6 +388,7 @@ Ostream& operator<<(Ostream& os, const InfoProxy& ip); // ------ Manipulators (not taking arguments) // -------------------------------------------------------------------- +//- An IOstream manipulator typedef IOstream& (*IOstreamManip)(IOstream&); //- operator<< handling for manipulators without arguments diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H index 68a849794d..c178447ab4 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H @@ -61,7 +61,7 @@ class Istream : public IOstream { - // Private data + // Private Data //- Has a token been put back on the stream? bool putBack_; @@ -69,12 +69,6 @@ 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: @@ -89,9 +83,7 @@ public: ) : IOstream(format, version, compression), - putBack_(false), - labelByteSize_(sizeof(Foam::label)), - scalarByteSize_(sizeof(Foam::scalar)) + putBack_(false) {} @@ -101,34 +93,7 @@ public: // 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 + // Read Functions //- Put back token // Only a single put back is permitted @@ -168,10 +133,10 @@ public: virtual Istream& read(char*, std::streamsize) = 0; //- Start of low-level raw binary read - virtual bool beginRaw() = 0; + virtual bool beginRawRead() = 0; //- End of low-level raw binary read - virtual bool endRaw() = 0; + virtual bool endRawRead() = 0; //- Low-level raw binary read virtual Istream& readRaw(char*, std::streamsize) = 0; @@ -212,6 +177,7 @@ public: // ------ Manipulators (not taking arguments) // -------------------------------------------------------------------- +//- An Istream manipulator typedef Istream& (*IstreamManip)(Istream&); //- operator>> handling for manipulators without arguments diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C index 6abfb3da77..43ebddc5e5 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C @@ -38,8 +38,7 @@ void Foam::Ostream::decrIndent() if (!indentLevel_) { std::cerr - << "Ostream::decrIndent() : attempt to decrement 0 indent level" - << std::endl; + << "Ostream::decrIndent() : attempt to decrement 0 indent level\n"; } else { @@ -59,6 +58,12 @@ Foam::Ostream& Foam::Ostream::writeKeyword(const keyType& kw) indent(); writeQuoted(kw, kw.isPattern()); + if (indentSize_ <= 1) + { + write(char(token::SPACE)); + return *this; + } + label nSpaces = entryIndentation_ - label(kw.size()); // Account for quotes surrounding pattern diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H index ee02e3bc80..b27594fe81 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -46,7 +46,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations class token; /*---------------------------------------------------------------------------*\ @@ -57,19 +57,18 @@ class Ostream : public IOstream { - protected: // Protected data - //- Number of spaces per indent level - static const unsigned short indentSize_ = 4; - //- Indentation of the entry from the start of the keyword - static const unsigned short entryIndentation_ = 16; + static constexpr const unsigned short entryIndentation_ = 16; + + //- Number of spaces per indent level + unsigned short indentSize_ = 4; //- Current indent level - unsigned short indentLevel_; + unsigned short indentLevel_ = 0; public: @@ -84,8 +83,7 @@ public: compressionType compression=UNCOMPRESSED ) : - IOstream(format, version, compression), - indentLevel_(0) + IOstream(format, version, compression) {} @@ -93,9 +91,9 @@ public: virtual ~Ostream() = default; - // Member functions + // Member Functions - // Write functions + // Write Functions //- Write token to stream or otherwise handle it. // \return false if the token type was not handled by this method @@ -151,14 +149,26 @@ public: //- Emit begin marker for low-level raw binary output. // The count indicates the number of bytes for subsequent // writeRaw calls. - virtual bool beginRaw(std::streamsize count) = 0; + virtual bool beginRawWrite(std::streamsize count) = 0; //- Emit end marker for low-level raw binary output. - virtual bool endRaw() = 0; + virtual bool endRawWrite() = 0; //- Add indentation characters virtual void indent() = 0; + //- Return indent level + unsigned short indentSize() const + { + return indentSize_; + } + + //- Access to indent size + unsigned short& indentSize() + { + return indentSize_; + } + //- Return indent level unsigned short indentLevel() const { @@ -276,6 +286,7 @@ public: // ------ Manipulators (not taking arguments) // -------------------------------------------------------------------- +//- An Ostream manipulator typedef Ostream& (*OstreamManip)(Ostream&); //- operator<< handling for manipulators without arguments diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C index 06a4d70a04..1ed8f2dc54 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C @@ -384,9 +384,9 @@ Foam::Istream& Foam::UIPstream::read(doubleScalar& val) Foam::Istream& Foam::UIPstream::read(char* data, std::streamsize count) { - beginRaw(); + beginRawRead(); readRaw(data, count); - endRaw(); + endRawRead(); return *this; } @@ -395,7 +395,7 @@ Foam::Istream& Foam::UIPstream::read(char* data, std::streamsize count) Foam::Istream& Foam::UIPstream::readRaw(char* data, std::streamsize count) { // No check for format() == BINARY since this is either done in the - // beginRaw() method, or the caller knows what they are doing. + // beginRawRead() method, or the caller knows what they are doing. // Any alignment must have been done prior to this call readFromBuffer(data, count); @@ -403,7 +403,7 @@ Foam::Istream& Foam::UIPstream::readRaw(char* data, std::streamsize count) } -bool Foam::UIPstream::beginRaw() +bool Foam::UIPstream::beginRawRead() { if (format() != BINARY) { diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H index 42cf52e36c..2bc84433e0 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H @@ -175,10 +175,10 @@ public: Istream& readRaw(char* data, std::streamsize count); //- Start of low-level raw binary read - bool beginRaw(); + bool beginRawRead(); //- End of low-level raw binary read - bool endRaw() + bool endRawRead() { return true; } diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C index 2002061f9a..82a79a0c9b 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C @@ -323,11 +323,7 @@ Foam::Ostream& Foam::UOPstream::write(const doubleScalar val) } -Foam::Ostream& Foam::UOPstream::write -( - const char* data, - const std::streamsize count -) +Foam::Ostream& Foam::UOPstream::write(const char* data, std::streamsize count) { if (format() != BINARY) { @@ -345,20 +341,20 @@ Foam::Ostream& Foam::UOPstream::write Foam::Ostream& Foam::UOPstream::writeRaw ( const char* data, - const std::streamsize count + std::streamsize count ) { // No check for format() == BINARY since this is either done in the - // beginRaw() method, or the caller knows what they are doing. + // beginRawWrite() method, or the caller knows what they are doing. - // Previously aligned and sizes reserved via beginRaw() + // Previously aligned and sizes reserved via beginRawWrite() writeToBuffer(data, count, 1); return *this; } -bool Foam::UOPstream::beginRaw(const std::streamsize count) +bool Foam::UOPstream::beginRawWrite(std::streamsize count) { if (format() != BINARY) { diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H index c572f5543a..996547cdff 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H @@ -186,26 +186,18 @@ public: virtual Ostream& write(const doubleScalar val); //- Write binary block with 8-byte alignment. - virtual Ostream& write - ( - const char* data, - const std::streamsize count - ); + virtual Ostream& write(const char* data, std::streamsize count); //- Low-level raw binary output. - virtual Ostream& writeRaw - ( - const char* data, - const std::streamsize count - ); + virtual Ostream& writeRaw(const char* data, std::streamsize count); //- Begin marker for low-level raw binary output. // The count indicates the number of bytes for subsequent // writeRaw calls. - virtual bool beginRaw(const std::streamsize count); + virtual bool beginRawWrite(std::streamsize count); //- End marker for low-level raw binary output. - virtual bool endRaw() + virtual bool endRawWrite() { return true; } diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C index e42c3a8f79..152bca0ed6 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C @@ -778,9 +778,9 @@ Foam::Istream& Foam::ISstream::read(doubleScalar& val) Foam::Istream& Foam::ISstream::read(char* buf, std::streamsize count) { - beginRaw(); + beginRawRead(); readRaw(buf, count); - endRaw(); + endRawRead(); return *this; } @@ -795,7 +795,7 @@ Foam::Istream& Foam::ISstream::readRaw(char* buf, std::streamsize count) } -bool Foam::ISstream::beginRaw() +bool Foam::ISstream::beginRawRead() { if (format() != BINARY) { @@ -811,7 +811,7 @@ bool Foam::ISstream::beginRaw() } -bool Foam::ISstream::endRaw() +bool Foam::ISstream::endRawRead() { readEnd("binaryBlock"); setState(is_.rdstate()); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H index 6d4eedcda4..4454afed42 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H @@ -55,20 +55,21 @@ class ISstream : public Istream { - // Private data + // Private Data fileName name_; + std::istream& is_; // Private Member Functions + //- Get the next valid character char nextValid(); + //- Get a word token void readWordToken(token& t); - // Private Member Functions - //- Read a verbatim string (excluding block delimiters). // The leading "#{" has been removed prior to calling, @@ -124,7 +125,7 @@ public: virtual ios_base::fmtflags flags() const; - // Read functions + // Read Functions //- Raw, low-level get character function. inline ISstream& get(char& c); @@ -171,10 +172,10 @@ public: virtual Istream& readRaw(char* data, std::streamsize count); //- Start of low-level raw binary read - virtual bool beginRaw(); + virtual bool beginRawRead(); //- End of low-level raw binary read - virtual bool endRaw(); + virtual bool endRawRead(); //- Rewind the stream so that it may be read again virtual void rewind(); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C index a9cea39ace..fbd2b3cbc0 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C @@ -196,21 +196,17 @@ Foam::Ostream& Foam::OSstream::write(const doubleScalar val) } -Foam::Ostream& Foam::OSstream::write -( - const char* data, - const std::streamsize count -) +Foam::Ostream& Foam::OSstream::write(const char* data, std::streamsize count) { - beginRaw(count); + beginRawWrite(count); writeRaw(data, count); - endRaw(); + endRawWrite(); return *this; } -bool Foam::OSstream::beginRaw(const std::streamsize count) +bool Foam::OSstream::beginRawWrite(std::streamsize count) { if (format() != BINARY) { @@ -226,7 +222,7 @@ bool Foam::OSstream::beginRaw(const std::streamsize count) } -bool Foam::OSstream::endRaw() +bool Foam::OSstream::endRawWrite() { os_ << token::END_LIST; setState(os_.rdstate()); @@ -242,7 +238,7 @@ Foam::Ostream& Foam::OSstream::writeRaw ) { // No check for format() == BINARY since this is either done in the - // beginRaw() method, or the caller knows what they are doing. + // beginRawWrite() method, or the caller knows what they are doing. os_.write(data, count); setState(os_.rdstate()); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H index 48da2e0a2d..ed355eed1f 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H @@ -146,26 +146,22 @@ public: virtual Ostream& write(const doubleScalar val); //- Write binary block - virtual Ostream& write - ( - const char* data, - const std::streamsize count - ); + virtual Ostream& write(const char* data, std::streamsize count); - //- Low-level raw binary output. + //- Low-level raw binary output virtual Ostream& writeRaw ( const char* data, - const std::streamsize count + std::streamsize count ); //- Begin marker for low-level raw binary output. // The count indicates the number of bytes for subsequent // writeRaw calls. - virtual bool beginRaw(const std::streamsize count); + virtual bool beginRawWrite(std::streamsize count); //- End marker for low-level raw binary output. - virtual bool endRaw(); + virtual bool endRawWrite(); //- Add indentation characters virtual void indent(); diff --git a/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H b/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H index 7d1383399f..02df5df7e6 100644 --- a/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H +++ b/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H @@ -265,13 +265,13 @@ public: virtual Istream& readRaw(char* data, std::streamsize count); //- Start of low-level raw binary read - virtual bool beginRaw() + virtual bool beginRawRead() { return false; } //- End of low-level raw binary read - virtual bool endRaw() + virtual bool endRawRead() { return false; } diff --git a/src/OpenFOAM/db/IOstreams/dummy/dummyISstream.H b/src/OpenFOAM/db/IOstreams/dummy/dummyISstream.H index 3e6502a281..eb343588fe 100644 --- a/src/OpenFOAM/db/IOstreams/dummy/dummyISstream.H +++ b/src/OpenFOAM/db/IOstreams/dummy/dummyISstream.H @@ -134,13 +134,13 @@ public: } //- Start of low-level raw binary read - virtual bool beginRaw() + virtual bool beginRawRead() { return false; } //- End of low-level raw binary read - virtual bool endRaw() + virtual bool endRawRead() { return false; } diff --git a/src/OpenFOAM/db/IOstreams/dummy/dummyIstream.H b/src/OpenFOAM/db/IOstreams/dummy/dummyIstream.H index 3543dc084a..3bd060ad7b 100644 --- a/src/OpenFOAM/db/IOstreams/dummy/dummyIstream.H +++ b/src/OpenFOAM/db/IOstreams/dummy/dummyIstream.H @@ -131,13 +131,13 @@ public: } //- Start of low-level raw binary read - virtual bool beginRaw() + virtual bool beginRawRead() { return false; } //- End of low-level raw binary read - virtual bool endRaw() + virtual bool endRawRead() { return false; }