threadedCollatedOFstream.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::threadedCollatedOFstream
28 
29 Description
30  Master-only drop-in replacement for OFstream.
31 
32 SourceFiles
33  threadedCollatedOFstream.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef threadedCollatedOFstream_H
38 #define threadedCollatedOFstream_H
39 
40 #include "StringStream.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class OFstreamCollator;
48 
49 /*---------------------------------------------------------------------------*\
50  Class threadedCollatedOFstream Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public OStringStream
56 {
57  // Private data
58 
59  OFstreamCollator& writer_;
60 
61  const fileName pathName_;
62 
63  const IOstream::compressionType compression_;
64 
65  const bool useThread_;
66 
67 
68 public:
69 
70  // Constructors
71 
72  //- Construct and set stream status
74  (
76  const fileName& pathname,
80  const bool useThread = true
81  );
82 
83 
84  //- Destructor
86 };
87 
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 } // End namespace Foam
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 #endif
96 
97 // ************************************************************************* //
Foam::IOstreamOption::UNCOMPRESSED
compression = false
Definition: IOstreamOption.H:73
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::IOstreamOption::format
streamFormat format() const noexcept
Get the current stream format.
Definition: IOstreamOption.H:273
Foam::IOstreamOption::currentVersion
static const versionNumber currentVersion
The current version number.
Definition: IOstreamOption.H:193
StringStream.H
Input/output from string buffers.
Foam::threadedCollatedOFstream::~threadedCollatedOFstream
~threadedCollatedOFstream()
Destructor.
Definition: threadedCollatedOFstream.C:54
Foam::IOstreamOption::versionNumber
Representation of a major/minor version number.
Definition: IOstreamOption.H:79
Foam::IOstreamOption::version
versionNumber version() const noexcept
Get the stream version.
Definition: IOstreamOption.H:321
Foam::IOstreamOption::streamFormat
streamFormat
Data format (ascii | binary)
Definition: IOstreamOption.H:64
Foam::threadedCollatedOFstream
Master-only drop-in replacement for OFstream.
Definition: threadedCollatedOFstream.H:52
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::OFstreamCollator
Threaded file writer.
Definition: OFstreamCollator.H:71
Foam::IOstreamOption::ASCII
"ascii"
Definition: IOstreamOption.H:66
Foam::OStringStream
Output to string buffer, using a OSstream.
Definition: StringStream.H:189
Foam::threadedCollatedOFstream::threadedCollatedOFstream
threadedCollatedOFstream(OFstreamCollator &, const fileName &pathname, streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED, const bool useThread=true)
Construct and set stream status.
Definition: threadedCollatedOFstream.C:35
Foam::IOstreamOption::compressionType
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
Definition: IOstreamOption.H:71
Foam::IOstreamOption::compression
compressionType compression() const noexcept
Get the stream compression.
Definition: IOstreamOption.H:297