LList.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 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 "error.H"
27 #include "LList.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class LListBase, class T>
33 :
34  LListBase()
35 {
36  for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
37  {
38  this->append(iter());
39  }
40 }
41 
42 
43 template<class LListBase, class T>
45 {
46  this->clear();
47 }
48 
49 
50 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
51 
52 template<class LListBase, class T>
54 {
55  label oldSize = this->size();
56  for (label i=0; i<oldSize; ++i)
57  {
58  this->removeHead();
59  }
60 
62 }
63 
64 
65 template<class LListBase, class T>
67 {
68  clear();
69  LListBase::transfer(lst);
70 }
71 
72 
73 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
74 
75 template<class LListBase, class T>
77 {
78  this->clear();
79 
80  for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
81  {
82  this->append(iter());
83  }
84 }
85 
86 
87 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
88 
89 #include "LListIO.C"
90 
91 
92 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
LList()
Null construct.
Definition: LList.H:108
const iterator & end()
Definition: LList.H:273
tUEqn clear()
Template class for non-intrusive linked lists.
Definition: LList.H:51
An STL-conforming const_iterator.
Definition: LList.H:284
T removeHead()
Remove and return head.
Definition: LList.H:172
void transfer(LList< LListBase, T > &)
Transfer the contents of the argument into this List.
Definition: LList.C:66
void operator=(const LList< LListBase, T > &)
Definition: LList.C:76
~LList()
Destructor.
Definition: LList.C:44
void clear()
Delete contents of list.
Definition: LList.C:53
iterator begin()
Definition: LList.H:268
void append(const T &a)
Add at tail of list.
Definition: LList.H:166