ENH: make treatment of stream allocators more uniform (issue #532)

- use allocator class to wrap the stream pointers instead of passing
  them into ISstream, OSstream and using a dynamic cast to delete
  then. This is especially important if we will have a bidirectional
  stream (can't delete twice!).

STYLE:

- file stream constructors with std::string (C++11)

- for rewind, explicit about in|out direction. This is not currently
  important, but avoids surprises with any future bidirectional access.

- combined string streams in StringStream.H header.
  Similar to <sstream> include that has both input and output string
  streams.
This commit is contained in:
Mark Olesen
2017-07-17 15:14:38 +02:00
parent b0db30ba2f
commit 86ef9e86dc
112 changed files with 708 additions and 624 deletions

View File

@ -31,17 +31,18 @@ License
int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2));
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::messageStream::messageStream
(
const string& title,
errorSeverity sev,
const errorSeverity severity,
const int maxErrors
)
:
title_(title),
severity_(sev),
severity_(severity),
maxErrors_(maxErrors),
errorCount_(0)
{}
@ -56,6 +57,8 @@ Foam::messageStream::messageStream(const dictionary& dict)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::OSstream& Foam::messageStream::masterStream(const label communicator)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
@ -76,6 +79,8 @@ Foam::OSstream& Foam::messageStream::masterStream(const label communicator)
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
Foam::OSstream& Foam::messageStream::operator()
(
const char* functionName,
@ -237,7 +242,7 @@ Foam::messageStream::operator Foam::OSstream&()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Global Variables * * * * * * * * * * * * * //
Foam::messageStream Foam::SeriousError
(