1 /*---------------------------------------------------------------------------* \
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "IOPtrList.H"
28 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
32 Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const INew& inewt)
38 io.readOpt() == IOobject::MUST_READ
39 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
42 PtrList<T>::read(readStream(typeName), inewt);
49 Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
55 io.readOpt() == IOobject::MUST_READ
56 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
59 PtrList<T>::read(readStream(typeName), INew<T>());
66 Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label s)
71 if (io.readOpt() != IOobject::NO_READ)
73 FatalErrorIn("IOPtrList<T>::IOPtrList(const IOobject&, const label)")
74 << "NO_READ must be set if specifying size" << nl
81 Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
87 io.readOpt() == IOobject::MUST_READ
88 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
91 PtrList<T>::read(readStream(typeName), INew<T>());
96 PtrList<T>::operator=(list);
102 Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const Xfer<PtrList<T> >& list)
106 PtrList<T>::transfer(list());
110 io.readOpt() == IOobject::MUST_READ
111 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
114 PtrList<T>::read(readStream(typeName), INew<T>());
120 // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
123 Foam::IOPtrList<T>::~IOPtrList()
127 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
130 bool Foam::IOPtrList<T>::writeData(Ostream& os) const
132 return (os << *this).good();
136 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
139 void Foam::IOPtrList<T>::operator=(const IOPtrList<T>& rhs)
141 PtrList<T>::operator=(rhs);
144 // ************************************************************************* //