1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Output inter-processor communications stream operating on external
34 \*---------------------------------------------------------------------------*/
43 #include "DynamicList.H"
44 #include "PstreamBuffers.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 /*---------------------------------------------------------------------------*\
52 Class UOPstream Declaration
53 \*---------------------------------------------------------------------------*/
64 DynamicList<char>& sendBuf_;
68 const bool sendAtDestruct_;
71 // Private Member Functions
73 //- Write a T to the transfer buffer
75 inline void writeToBuffer(const T&);
77 //- Write a char to the transfer buffer
78 inline void writeToBuffer(const char&);
80 //- Write data to the transfer buffer
81 inline void writeToBuffer(const void* data, size_t count, size_t align);
88 //- Construct given process index to send to and optional buffer size,
89 // write format and IO version
92 const commsTypes commsType,
94 DynamicList<char>& sendBuf,
95 const int tag = UPstream::msgType(),
96 const bool sendAtDestruct = true,
97 streamFormat format=BINARY,
98 versionNumber version=currentVersion
101 //- Construct given buffers
102 UOPstream(const int toProcNo, PstreamBuffers&);
113 //- Return flags of output stream
114 ios_base::fmtflags flags() const
116 return ios_base::fmtflags(0);
122 //- Write given buffer to given processor
125 const commsTypes commsType,
128 const std::streamsize bufSize,
129 const int tag = UPstream::msgType()
132 //- Write next token to stream
133 Ostream& write(const token&);
136 Ostream& write(const char);
138 //- Write character string
139 Ostream& write(const char*);
142 Ostream& write(const word&);
145 Ostream& write(const string&);
147 //- Write std::string surrounded by quotes.
148 // Optional write without quotes.
152 const bool quoted=true
156 Ostream& write(const label);
158 //- Write floatScalar
159 Ostream& write(const floatScalar);
161 //- Write doubleScalar
162 Ostream& write(const doubleScalar);
164 //- Write binary block
165 Ostream& write(const char*, std::streamsize);
167 //- Add indentation characters
172 // Stream state functions
178 //- Add newline and flush stream
182 //- Get width of output field
188 //- Set width of output field (and return old width)
194 //- Get precision of output field
195 int precision() const
200 //- Set precision of output field (and return old precision)
201 int precision(const int)
209 //- Set flags of stream
210 ios_base::fmtflags flags(const ios_base::fmtflags)
212 return ios_base::fmtflags(0);
218 //- Print description of IOstream to Ostream
219 void print(Ostream&) const;
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 } // End namespace Foam
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 // ************************************************************************* //