Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / containers / IOLongList / IOLongList.C
blob8a2d1dea5dc0d0997fc60e10267ca47b7cc3469b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | cfMesh: A library for mesh generation
4    \\    /   O peration     |
5     \\  /    A nd           | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6      \\/     M anipulation  | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9     This file is part of cfMesh.
11     cfMesh 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 3 of the License, or (at your
14     option) any later version.
16     cfMesh 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.
21     You should have received a copy of the GNU General Public License
22     along with cfMesh.  If not, see <http://www.gnu.org/licenses/>.
24 Description
25     An IOLongList of a given type is a list which supports automated
26     input and output.
28 \*---------------------------------------------------------------------------*/
30 #include "IOLongList.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 template<class T, label Offset>
40 IOLongList<T, Offset>::IOLongList(const IOobject& io)
42     regIOobject(io),
43     LongList<T, Offset>()
45     if
46     (
47         io.readOpt() == IOobject::MUST_READ
48      || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
49     )
50     {
51         readStream(typeName) >> *this;
52         close();
53     }
57 template<class T, label Offset>
58 IOLongList<T, Offset>::IOLongList
60     const IOobject& io,
61     const label size
64     regIOobject(io),
65     LongList<T, Offset>(size)
69 template<class T, label Offset>
70 IOLongList<T, Offset>::IOLongList
72     const IOobject& io,
73     const LongList<T, Offset>& list
76     regIOobject(io),
77     LongList<T, Offset>()
79     if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
80     {
81         readStream(typeName) >> *this;
82         close();
83     }
85     LongList<T, Offset>::operator=(list);
89 template<class T, label Offset>
90 void IOLongList<T, Offset>::operator=
92     const IOLongList<T, Offset>& rhs
95     LongList<T, Offset>::operator=(rhs);
99 template<class T, label Offset>
100 void IOLongList<T, Offset>::operator=
102     const LongList<T, Offset>& rhs
105     LongList<T, Offset>::operator=(rhs);
109 template<class T, label Offset>
110 bool IOLongList<T, Offset>::writeData(Ostream& os) const
112     return (os << *this).good();
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 } // End namespace Foam
120 // ************************************************************************* //