From 646b0aab3643fa3413e11cd9e698f7e68e7f8613 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Tue, 5 Sep 2023 18:23:58 +0200 Subject: [PATCH] ENH: allow modification of OSstream name - can be useful when using memory-based streams for buffering, in which case the name() can be used to specify the filesystem location instead of the default stream names ("input", "output"). --- src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H | 4 ++++ src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H index 89f232b4011..cb09f060fe3 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H @@ -59,8 +59,10 @@ class ISstream { // Private Data + //- The input stream path fileName name_; + //- The input stream std::istream& is_; @@ -129,6 +131,8 @@ public: virtual const fileName& name() const override { return name_; } //- The name of the input serial stream, for modification. + // Use with caution since some classes (eg, Fstream) + // also use this for filesystem information! virtual fileName& name() { return name_; } diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H index 70dcd99bba7..dd76e3d8b00 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H @@ -58,8 +58,10 @@ class OSstream { // Private Data + //- The output stream path fileName name_; + //- The output stream std::ostream& os_; @@ -119,6 +121,11 @@ public: //- (eg, the name of the Fstream file name) virtual const fileName& name() const override { return name_; } + //- The name of the output serial stream, for modification. + // Use with caution since some classes (eg, Fstream) + // also use this for filesystem information! + virtual fileName& name() { return name_; } + // STL stream -- GitLab