1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
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 \*---------------------------------------------------------------------------*/
26 #include "FixedList.H"
27 #include "ListLoopM.H"
29 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31 // * * * * * * * * * * * * * * STL Member Functions * * * * * * * * * * * * //
33 template<class T, unsigned Size>
34 void Foam::FixedList<T, Size>::swap(FixedList<T, Size>& a)
36 List_ACCESS(T, (*this), vp);
37 List_ACCESS(T, a, ap);
39 List_FOR_ALL((*this), i)
40 tmp = List_ELEM((*this), vp, i);
41 List_ELEM((*this), vp, i) = List_ELEM(a, ap, i);
42 List_ELEM(a, ap, i) = tmp;
47 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
49 template<class T, unsigned Size>
50 bool Foam::FixedList<T, Size>::operator==(const FixedList<T, Size>& a) const
54 List_CONST_ACCESS(T, (*this), vp);
55 List_CONST_ACCESS(T, (a), ap);
57 List_FOR_ALL((*this), i)
58 equal = equal && (List_ELEM((*this), vp, i) == List_ELEM((a), ap, i));
65 template<class T, unsigned Size>
66 bool Foam::FixedList<T, Size>::operator!=(const FixedList<T, Size>& a) const
68 return !operator==(a);
72 template<class T, unsigned Size>
73 bool Foam::FixedList<T, Size>::operator<(const FixedList<T, Size>& a) const
77 const_iterator vi = cbegin(), ai = a.cbegin();
78 vi < cend() && ai < a.cend();
103 template<class T, unsigned Size>
104 bool Foam::FixedList<T, Size>::operator>(const FixedList<T, Size>& a) const
106 return a.operator<(*this);
110 template<class T, unsigned Size>
111 bool Foam::FixedList<T, Size>::operator<=(const FixedList<T, Size>& a) const
113 return !operator>(a);
117 template<class T, unsigned Size>
118 bool Foam::FixedList<T, Size>::operator>=(const FixedList<T, Size>& a) const
120 return !operator<(a);
124 // * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
126 #include "FixedListIO.C"
128 // ************************************************************************* //