Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
db
IOstreams
Sstreams
prefixOSstream.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
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.
15
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
19
for more details.
20
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/>.
23
24
Class
25
Foam::prefixOSstream
26
27
Description
28
Version of OSstream which prints a prefix on each line.
29
30
This is useful for running in parallel as it allows the processor number
31
to be automatically prepended to each message line.
32
33
SourceFiles
34
prefixOSstream.C
35
36
\*---------------------------------------------------------------------------*/
37
38
#ifndef prefixOSstream_H
39
#define prefixOSstream_H
40
41
#include <
OpenFOAM/OSstream.H
>
42
43
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45
namespace
Foam
46
{
47
48
/*---------------------------------------------------------------------------*\
49
Class prefixOSstream Declaration
50
\*---------------------------------------------------------------------------*/
51
52
class
prefixOSstream
53
:
54
public
OSstream
55
{
56
// Private data
57
58
bool
printPrefix_;
59
string
prefix_;
60
61
62
// Private member functions
63
64
inline
void
checkWritePrefix();
65
66
67
public
:
68
69
// Constructors
70
71
//- Set stream status
72
prefixOSstream
73
(
74
ostream& os,
75
const
string
&
name
,
76
streamFormat
format
=
ASCII
,
77
versionNumber
version
=
currentVersion
,
78
compressionType
compression
=
UNCOMPRESSED
79
);
80
81
82
// Member functions
83
84
// Enquiry
85
86
//- Return the prefix of the stream
87
const
string
&
prefix
()
const
88
{
89
return
prefix_;
90
}
91
92
//- Return non-const access to the prefix of the stream
93
string
&
prefix
()
94
{
95
return
prefix_;
96
}
97
98
99
// Write functions
100
101
//- Write next token to stream
102
virtual
Ostream
&
write
(
const
token
&);
103
104
//- Write character
105
virtual
Ostream
&
write
(
const
char
);
106
107
//- Write character string
108
virtual
Ostream
&
write
(
const
char
*);
109
110
//- Write word
111
virtual
Ostream
&
write
(
const
word
&);
112
113
//- Write string
114
virtual
Ostream
&
write
(
const
string
&);
115
116
//- Write std::string surrounded by quotes.
117
// Optional write without quotes.
118
virtual
Ostream
&
writeQuoted
119
(
120
const
std::string&,
121
const
bool
quoted=
true
122
);
123
124
//- Write label
125
virtual
Ostream
&
write
(
const
label);
126
127
//- Write floatScalar
128
virtual
Ostream
&
write
(
const
floatScalar
);
129
130
//- Write doubleScalar
131
virtual
Ostream
&
write
(
const
doubleScalar
);
132
133
//- Write binary block
134
virtual
Ostream
&
write
(
const
char
*, std::streamsize);
135
136
//- Add indentation characters
137
virtual
void
indent
();
138
139
140
// Print
141
142
//- Print description of IOstream to Ostream
143
virtual
void
print
(
Ostream
&)
const
;
144
};
145
146
147
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148
149
}
// End namespace Foam
150
151
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152
153
#endif
154
155
// ************************ vim: set sw=4 sts=4 et: ************************ //