1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
28 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
31 Foam::IOList<T>::IOList(const IOobject& io)
36 if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
38 WarningIn("IOList::IOList(const IOobject&)")
39 << "IOList " << name()
40 << " constructed with IOobject::MUST_READ_IF_MODIFIED"
41 " but IOList does not support automatic rereading."
47 io.readOpt() == IOobject::MUST_READ
48 || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
50 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
53 readStream(typeName) >> *this;
60 Foam::IOList<T>::IOList(const IOobject& io, const label size)
65 if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
67 WarningIn("IOList::IOList(const IOobject&, const label)")
68 << "IOList " << name()
69 << " constructed with IOobject::MUST_READ_IF_MODIFIED"
70 " but IOList does not support automatic rereading."
76 io.readOpt() == IOobject::MUST_READ
77 || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
79 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
82 readStream(typeName) >> *this;
87 List<T>::setSize(size);
93 Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
98 if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
100 WarningIn("IOList::IOList(const IOobject&, const List<T>&)")
101 << "IOList " << name()
102 << " constructed with IOobject::MUST_READ_IF_MODIFIED"
103 " but IOList does not support automatic rereading."
110 io.readOpt() == IOobject::MUST_READ
111 || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
113 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
116 readStream(typeName) >> *this;
121 List<T>::operator=(list);
127 Foam::IOList<T>::IOList(const IOobject& io, const Xfer<List<T> >& list)
132 if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
136 "IOList::IOList(const IOobject&, const Xfer<List<T> >&)"
137 ) << "IOList " << name()
138 << " constructed with IOobject::MUST_READ_IF_MODIFIED"
139 " but IOList does not support automatic rereading."
143 List<T>::transfer(list());
148 io.readOpt() == IOobject::MUST_READ
149 || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
151 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
154 readStream(typeName) >> *this;
160 // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
163 Foam::IOList<T>::~IOList()
168 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
171 bool Foam::IOList<T>::writeData(Ostream& os) const
173 return (os << *this).good();
177 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
180 void Foam::IOList<T>::operator=(const IOList<T>& rhs)
182 List<T>::operator=(rhs);
187 void Foam::IOList<T>::operator=(const List<T>& rhs)
189 List<T>::operator=(rhs);
193 // ************************************************************************* //