1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Output inter-processor communications stream.
35 \*---------------------------------------------------------------------------*/
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class OPstream Declaration
51 \*---------------------------------------------------------------------------*/
63 // Private member functions
65 //- Write a T to the transfer buffer
67 inline void writeToBuffer(const T&);
69 //- Write a char to the transfer buffer
70 inline void writeToBuffer(const char&);
72 //- Write data to the transfer buffer
73 inline void writeToBuffer(const void* data, size_t count);
80 //- Construct given process index to send to and optional buffer size,
81 // write format and IO version
84 const commsTypes commsType,
86 const label bufSize = 0,
87 streamFormat format=BINARY,
88 versionNumber version=currentVersion
101 //- Return flags of output stream
102 ios_base::fmtflags flags() const
104 return ios_base::fmtflags(0);
110 //- Write given buffer to given processor
113 const commsTypes commsType,
116 const std::streamsize bufSize
119 //- Non-blocking writes: wait until all have finished.
120 static void waitRequests();
122 //- Non-blocking writes: has request i finished?
123 static bool finishedRequest(const label i);
125 //- Write next token to stream
126 Ostream& write(const token&);
129 Ostream& write(const char);
131 //- Write character string
132 Ostream& write(const char*);
135 Ostream& write(const word&);
138 Ostream& write(const string&);
141 Ostream& write(const label);
143 //- Write floatScalar
144 Ostream& write(const floatScalar);
146 //- Write doubleScalar
147 Ostream& write(const doubleScalar);
149 //- Write binary block
150 Ostream& write(const char*, std::streamsize);
152 //- Add indentation characters
157 // Stream state functions
163 //- Add '\n' and flush stream
167 //- Get width of output field
173 //- Set width of output field (and return old width)
179 //- Get precision of output field
180 int precision() const
185 //- Set precision of output field (and return old precision)
186 int precision(const int)
194 //- Set flags of stream
195 ios_base::fmtflags flags(const ios_base::fmtflags)
197 return ios_base::fmtflags(0);
203 //- Print description of IOstream to Ostream
204 void print(Ostream&) const;
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 } // End namespace Foam
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 // include inline implementaions
215 # include "OPstreamI.H"
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 // ************************************************************************* //