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,
77  IOstreamOption streamOpt = IOstreamOption(),
78  const bool useThread = true
79  );
80 
81  //- Construct and set stream status
83  (
85  const fileName& pathname,
86  streamFormat fmt,
88  compressionType comp = compressionType::UNCOMPRESSED,
89  const bool useThread = true
90  )
91  :
93  (
94  writer,
95  pathname,
96  IOstreamOption(fmt, ver, comp),
97  useThread
98  )
99  {}
100 
101 
102  //- Destructor
104 };
105 
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 } // End namespace Foam
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 #endif
114 
115 // ************************************************************************* //
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::IOstreamOption::IOstreamOption
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Definition: IOstreamOption.H:196
Foam::threadedCollatedOFstream::threadedCollatedOFstream
threadedCollatedOFstream(OFstreamCollator &writer, const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool useThread=true)
Construct and set stream status.
Definition: threadedCollatedOFstream.C:36
Foam::IOstreamOption::currentVersion
static const versionNumber currentVersion
The current version number (2.0)
Definition: IOstreamOption.H:168
StringStream.H
Input/output from string buffers.
Foam::threadedCollatedOFstream::~threadedCollatedOFstream
~threadedCollatedOFstream()
Destructor.
Definition: threadedCollatedOFstream.C:53
Foam::IOstreamOption::versionNumber
Representation of a major/minor version number.
Definition: IOstreamOption.H:85
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::IOstreamOption::streamFormat
streamFormat
Data format (ascii | binary)
Definition: IOstreamOption.H:70
Foam::threadedCollatedOFstream
Master-only drop-in replacement for OFstream.
Definition: threadedCollatedOFstream.H:52
Foam::writer
Base class for graphics format writing. Entry points are.
Definition: writer.H:80
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::OFstreamCollator
Threaded file writer.
Definition: OFstreamCollator.H:71
Foam::OStringStream
Output to string buffer, using a OSstream.
Definition: StringStream.H:196
Foam::IOstreamOption::compressionType
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
Definition: IOstreamOption.H:77