LList.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-2018 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 "LList.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class LListBase, class T>
32 :
33  LListBase()
34 {
35  for (const T& val : lst)
36  {
37  this->append(val);
38  }
39 }
40 
41 
42 template<class LListBase, class T>
43 Foam::LList<LListBase, T>::LList(std::initializer_list<T> lst)
44 :
45  LListBase()
46 {
47  for (const T& val : lst)
48  {
49  this->append(val);
50  }
51 }
52 
53 
54 template<class LListBase, class T>
56 {
57  this->clear();
58 }
59 
60 
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62 
63 template<class LListBase, class T>
65 {
66  label oldSize = this->size();
67  for (label i=0; i<oldSize; ++i)
68  {
69  this->removeHead();
70  }
71 
73 }
74 
75 
76 template<class LListBase, class T>
78 {
79  clear();
80  LListBase::transfer(lst);
81 }
82 
83 
84 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
85 
86 template<class LListBase, class T>
88 {
89  this->clear();
90 
91  for (const T& val : lst)
92  {
93  this->append(val);
94  }
95 }
96 
97 
98 template<class LListBase, class T>
99 void Foam::LList<LListBase, T>::operator=(std::initializer_list<T> lst)
100 {
101  this->clear();
102 
103  for (const T& val : lst)
104  {
105  this->append(val);
106  }
107 }
108 
109 
110 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
111 
112 #include "LListIO.C"
113 
114 // ************************************************************************* //
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
tUEqn clear()
Template class for non-intrusive linked lists.
Definition: LList.H:51
void transfer(LList< LListBase, T > &)
Transfer the contents of the argument into this List.
Definition: LList.C:77
void operator=(const LList< LListBase, T > &)
Assignment operator.
Definition: LList.C:87
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
~LList()
Destructor.
Definition: LList.C:55
void clear()
Delete contents of list.
Definition: LList.C:64
const volScalarField & T