UILList.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "UILList.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class LListBase, class T>
32 {
33  for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
34  {
35  this->append(&iter());
36  }
37 }
38 
39 
40 template<class LListBase, class T>
42 {
43  transfer(lst);
44 }
45 
46 
47 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
48 
49 template<class LListBase, class T>
51 {
53 
54  for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
55  {
56  this->append(&iter());
57  }
58 }
59 
60 
61 template<class LListBase, class T>
63 {
64  transfer(rhs);
65 }
66 
67 
68 template<class LListBase, class T>
70 (
71  const UILList<LListBase, T>& rhs
72 ) const
73 {
74  if (this->size() != rhs.size())
75  {
76  return false;
77  }
78 
79  bool equal = true;
80 
81  const_iterator iter1 = this->begin();
82  const_iterator iter2 = rhs.begin();
83 
84  for (; iter1 != this->end(); ++iter1, ++iter2)
85  {
86  equal = equal && iter1() == iter2();
87  }
88 
89  return equal;
90 }
91 
92 
93 template<class LListBase, class T>
95 (
96  const UILList<LListBase, T>& rhs
97 ) const
98 {
99  return !operator==(rhs);
100 }
101 
102 
103 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
104 
105 #include "UILListIO.C"
106 
107 
108 // ************************************************************************* //
An STL-conforming const_iterator.
Definition: UILList.H:237
Template class for intrusive linked lists.
Definition: UILList.H:69
UILList()
Null construct.
Definition: UILList.H:88
void operator=(const UILList< LListBase, T > &)
Assignment operator.
Definition: UILList.C:50
const iterator & end()
Definition: UILList.H:223
iterator begin()
Definition: UILList.H:218
tUEqn clear()
bool equal(const T &s1, const T &s2)
Definition: doubleFloat.H:62
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)