1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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.
34 \*---------------------------------------------------------------------------*/
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class OPstream Declaration
50 \*---------------------------------------------------------------------------*/
62 // Private member functions
64 //- Write a T to the transfer buffer
66 inline void writeToBuffer(const T&);
68 //- Write a char to the transfer buffer
69 inline void writeToBuffer(const char&);
71 //- Write data to the transfer buffer
72 inline void writeToBuffer(const void* data, size_t count, size_t align);
79 //- Construct given process index to send to and optional buffer size,
80 // write format and IO version
83 const commsTypes commsType,
85 const label bufSize = 0,
86 streamFormat format=BINARY,
87 versionNumber version=currentVersion
100 //- Return flags of output stream
101 ios_base::fmtflags flags() const
103 return ios_base::fmtflags(0);
109 //- Write given buffer to given processor
112 const commsTypes commsType,
115 const std::streamsize bufSize
118 //- Non-blocking writes: wait until all have finished.
119 static void waitRequests();
121 //- Non-blocking writes: has request i finished?
122 static bool finishedRequest(const label i);
124 //- Write next token to stream
125 Ostream& write(const token&);
128 Ostream& write(const char);
130 //- Write character string
131 Ostream& write(const char*);
134 Ostream& write(const word&);
137 Ostream& write(const string&);
139 //- Write std::string surrounded by quotes.
140 // Optional write without quotes.
144 const bool quoted=true
148 Ostream& write(const label);
150 //- Write floatScalar
151 Ostream& write(const floatScalar);
153 //- Write doubleScalar
154 Ostream& write(const doubleScalar);
156 //- Write binary block
157 Ostream& write(const char*, std::streamsize);
159 //- Add indentation characters
164 // Stream state functions
170 //- Add newline and flush stream
174 //- Get width of output field
180 //- Set width of output field (and return old width)
186 //- Get precision of output field
187 int precision() const
192 //- Set precision of output field (and return old precision)
193 int precision(const int)
201 //- Set flags of stream
202 ios_base::fmtflags flags(const ios_base::fmtflags)
204 return ios_base::fmtflags(0);
210 //- Print description of IOstream to Ostream
211 void print(Ostream&) const;
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 } // End namespace Foam
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 // ************************************************************************* //