mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: update and enhancement of memory-streams
- soft renames (ie, old names still available via typedefs) for more
reasonable names and more coverage with std stream variants.
The old names could be a bit cryptic.
For example, uiliststream (== an unallocated/external list storage),
which is written as std::ispanstream for C++23.
Could similarly argue that IListStream is better named as
ICharStream, since it is an input stream of characters and the
internal storage mechanism (List or something else) is mostly
irrelevant.
Extending the coverage to include all std stream variants, and
simply rewrap them for OpenFOAM IOstream types. This simplifies the
inheritance patterns and allows reuse of icharstream/ocharstream as
a drop-in replace for istringstream/ostringstream in other wrappers.
Classes:
* icharstream / ICharStream [old: none / IListStream]
* ocharstream / OCharStream [old: none / OListStream]
* ispanstream / ISpanStream [old: uiliststream / UIListStream]
* ospanstream / OSpanStream [old: none / UOListStream]
Possible new uses : read file contents into a buffer, broadcast
buffer contents to other ranks and then transfer into an icharstream
to be read from. This avoid the multiple intermediate copies that
would be associated when using an istringstream.
- Use size doubling instead of block-wise incremental for ocharstream
(OCharStream). This corresponds to the sizing behaviour as per
std::stringstream (according to gcc-11 includes)
STYLE: drop Foam_IOstream_extras constructors for memory streams
- transitional/legacy constructors but not used in any code
This commit is contained in:
committed by
Andrew Heather
parent
6d7e67408e
commit
a341d09afc
@ -29,7 +29,7 @@ License
|
||||
#include "IFstream.H"
|
||||
#include "ListOps.H"
|
||||
#include "stringOps.H"
|
||||
#include "UIListStream.H"
|
||||
#include "SpanStream.H"
|
||||
#include "cellModel.H"
|
||||
#include <cctype>
|
||||
|
||||
@ -328,15 +328,15 @@ Foam::fileFormats::ABAQUSCore::readHelper::readPoints
|
||||
// Read nodes (points) until next "*Section"
|
||||
while (is.peek() != '*' && is.peek() != EOF)
|
||||
{
|
||||
// Grab the line and wrap as string-stream
|
||||
// Grab the line and wrap as spanstream
|
||||
is.getLine(line);
|
||||
UIListStream ss(line.data(), line.length());
|
||||
|
||||
if (line.empty())
|
||||
{
|
||||
// Not sure if we should terminate on blank lines?
|
||||
continue;
|
||||
}
|
||||
ISpanStream ss(line);
|
||||
|
||||
// Parse line for ID, X, Y, Z
|
||||
ss >> id >> sep >> p.x() >> sep >> p.y() >> sep >> p.z();
|
||||
|
||||
Reference in New Issue
Block a user