DictionaryBaseIO.C
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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "DictionaryBase.H"
30#include "IOstreams.H"
31
32// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
33
34template<class IDLListType, class T>
35Foam::Ostream& Foam::operator<<
36(
37 Ostream& os,
38 const DictionaryBase<IDLListType, T>& dict)
39{
40 for (auto iter = dict.begin(); iter != dict.end(); ++iter)
41 {
42 os << *iter;
43
44 // Check stream before going to next entry.
45 if (!os.good())
46 {
47 Info
48 << "operator<<(Ostream&, const DictionaryBase&) : "
49 << "Can't write entry for DictionaryBase"
50 << endl;
51
52 break;
53 }
54 }
55
56 return os;
57}
58
59
60// ************************************************************************* //
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
OBJstream os(runTime.globalPath()/outputName)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
dictionary dict