mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: UIPstream when reaches eof deletes the underlying buffer.
Only in PstreamBuffers mode. This makes sure that data from other processors already handled gets deleted.
This commit is contained in:
@ -38,7 +38,17 @@ Foam::IPstream::IPstream
|
||||
)
|
||||
:
|
||||
Pstream(commsType, bufSize),
|
||||
UIPstream(commsType, fromProcNo, buf_, externalBufPosition_),
|
||||
UIPstream
|
||||
(
|
||||
commsType,
|
||||
fromProcNo,
|
||||
buf_,
|
||||
externalBufPosition_,
|
||||
UPstream::msgType(), // tag
|
||||
false, // do not clear buf_ if at end
|
||||
format,
|
||||
version
|
||||
),
|
||||
externalBufPosition_(0)
|
||||
{}
|
||||
|
||||
|
||||
@ -77,6 +77,21 @@ inline void Foam::UIPstream::readFromBuffer
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::UIPstream::~UIPstream()
|
||||
{
|
||||
if (clearAtEnd_ && eof())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UIPstream::~UIPstream() : clearing externalBuf_ of size "
|
||||
<< externalBuf_.size() << endl;
|
||||
}
|
||||
externalBuf_.clearStorage();
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::UIPstream::read(token& t)
|
||||
|
||||
@ -67,6 +67,8 @@ class UIPstream
|
||||
|
||||
const int tag_;
|
||||
|
||||
const bool clearAtEnd_;
|
||||
|
||||
label messageSize_;
|
||||
|
||||
|
||||
@ -96,6 +98,7 @@ public:
|
||||
DynamicList<char>& externalBuf,
|
||||
label& externalBufPosition,
|
||||
const int tag = UPstream::msgType(),
|
||||
const bool clearAtEnd = false, // destroy externalBuf if at end
|
||||
streamFormat format=BINARY,
|
||||
versionNumber version=currentVersion
|
||||
);
|
||||
@ -104,6 +107,11 @@ public:
|
||||
UIPstream(const int fromProcNo, PstreamBuffers&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~UIPstream();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Inquiry
|
||||
|
||||
Reference in New Issue
Block a user