1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 \*---------------------------------------------------------------------------*/
27 #include "FixedList.H"
28 #include "ListLoopM.H"
30 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 // * * * * * * * * * * * * * * STL Member Functions * * * * * * * * * * * * //
34 template<class T, unsigned Size>
35 void Foam::FixedList<T, Size>::swap(FixedList<T, Size>& a)
37 List_ACCESS(T, (*this), vp);
38 List_ACCESS(T, a, ap);
40 List_FOR_ALL((*this), i)
41 tmp = List_ELEM((*this), vp, i);
42 List_ELEM((*this), vp, i) = List_ELEM(a, ap, i);
43 List_ELEM(a, ap, i) = tmp;
48 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
50 template<class T, unsigned Size>
51 bool Foam::FixedList<T, Size>::operator==(const FixedList<T, Size>& a) const
55 List_CONST_ACCESS(T, (*this), vp);
56 List_CONST_ACCESS(T, (a), ap);
58 List_FOR_ALL((*this), i)
59 equal = equal && (List_ELEM((*this), vp, i) == List_ELEM((a), ap, i));
66 template<class T, unsigned Size>
67 bool Foam::FixedList<T, Size>::operator!=(const FixedList<T, Size>& a) const
69 return !operator==(a);
73 template<class T, unsigned Size>
74 bool Foam::FixedList<T, Size>::operator<(const FixedList<T, Size>& a) const
78 const_iterator vi = cbegin(), ai = a.cbegin();
79 vi < cend() && ai < a.cend();
104 template<class T, unsigned Size>
105 bool Foam::FixedList<T, Size>::operator>(const FixedList<T, Size>& a) const
107 return a.operator<(*this);
111 template<class T, unsigned Size>
112 bool Foam::FixedList<T, Size>::operator<=(const FixedList<T, Size>& a) const
114 return !operator>(a);
118 template<class T, unsigned Size>
119 bool Foam::FixedList<T, Size>::operator>=(const FixedList<T, Size>& a) const
121 return !operator<(a);
125 // * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
127 #include "FixedListIO.C"
129 // ************************************************************************* //