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
25 \*---------------------------------------------------------------------------*/
30 #include "contiguous.H"
32 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
35 void Foam::UList<T>::writeEntry(Ostream& os) const
40 && token::compound::isCompound
42 "List<" + word(pTraits<T>::typeName) + '>'
46 os << word("List<" + word(pTraits<T>::typeName) + '>') << " ";
54 void Foam::UList<T>::writeEntry(const word& keyword, Ostream& os) const
56 os.writeKeyword(keyword);
58 os << token::END_STATEMENT << endl;
63 Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
65 // Write list contents depending on data format
66 if (os.format() == IOstream::ASCII || !contiguous<T>())
70 if (L.size() > 1 && contiguous<T>())
86 // Write size and start delimiter
87 os << L.size() << token::BEGIN_BLOCK;
92 // Write end delimiter
93 os << token::END_BLOCK;
95 else if (L.size() < 11 && contiguous<T>())
97 // Write size and start delimiter
98 os << L.size() << token::BEGIN_LIST;
103 if (i > 0) os << token::SPACE;
107 // Write end delimiter
108 os << token::END_LIST;
112 // Write size and start delimiter
113 os << nl << L.size() << nl << token::BEGIN_LIST;
121 // Write end delimiter
122 os << nl << token::END_LIST << nl;
127 os << nl << L.size() << nl;
130 os.write(reinterpret_cast<const char*>(L.v_), L.byteSize());
134 // Check state of IOstream
135 os.check("Ostream& operator<<(Ostream&, const UList&)");
141 // ************************************************************************* //