ILList.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2017-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::ILList
29
30Description
31 Template class for intrusive linked lists.
32
33SourceFiles
34 ILList.C
35 ILListIO.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Foam_ILList_H
40#define Foam_ILList_H
41
42#include "UILList.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// Forward Declarations
50
51class Istream;
52class Ostream;
53template<class LListBase, class T> class ILList;
55template<class LListBase, class T> Istream& operator>>
56(
57 Istream& is,
59);
60
61
62/*---------------------------------------------------------------------------*\
63 Class ILList Declaration
64\*---------------------------------------------------------------------------*/
65
66template<class LListBase, class T>
67class ILList
68:
69 public UILList<LListBase, T>
70{
71 // Private Member Functions
72
73 //- Read from Istream using given Istream constructor class
74 template<class INew>
75 void readIstream(Istream& is, const INew& inew);
76
77
78public:
79
80 // Constructors
81
82 //- Default construct
83 ILList() = default;
84
85 //- Construct and add initial item pointer
86 explicit ILList(T* item)
87 :
88 UILList<LListBase, T>(item)
89 {}
90
91 //- Construct from Istream
92 explicit ILList(Istream& is);
93
94 //- Copy construct using the 'clone()' method for each element
95 ILList(const ILList<LListBase, T>& lst);
96
97 //- Move construct
99
100 //- Copy constructor with additional argument for clone 'clone()'
101 template<class CloneArg>
102 ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg);
103
104 //- Construct from Istream using given Istream constructor class
105 template<class INew>
106 ILList(Istream& is, const INew& inew);
107
108
109 //- Destructor
110 ~ILList();
111
112
113 // Member Functions
114
115 //- Remove the head element specified from the list and delete it
116 bool eraseHead();
117
118 //- Remove the specified element from the list and delete it
119 bool erase(T* item);
120
121 //- Clear the contents of the list
122 void clear();
123
124 //- Transfer the contents of the argument into this List
125 //- and annul the argument list.
127
128
129 // Member Operators
130
131 //- Copy assignment using the 'clone()' method for each element
132 void operator=(const ILList<LListBase, T>& lst);
133
134 //- Move assignment
136
137
138 // Istream Operator
139
140 //- Read from Istream, discarding existing contents.
141 friend Istream& operator>> <LListBase, T>
142 (
143 Istream& is,
145 );
146};
147
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151} // End namespace Foam
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155#ifdef NoRepository
156 #include "ILList.C"
157 #include "ILListIO.C"
158#endif
159
160// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161
162#endif
163
164// ************************************************************************* //
Template class for intrusive linked lists.
Definition: ILList.H:69
void transfer(ILList< LListBase, T > &lst)
Definition: ILList.C:115
bool eraseHead()
Remove the head element specified from the list and delete it.
Definition: ILList.C:83
ILList()=default
Default construct.
bool erase(T *item)
Remove the specified element from the list and delete it.
Definition: ILList.C:92
void clear()
Clear the contents of the list.
Definition: ILList.C:101
~ILList()
Destructor.
Definition: ILList.C:74
void operator=(const ILList< LListBase, T > &lst)
Copy assignment using the 'clone()' method for each element.
Definition: ILList.C:125
ILList(T *item)
Construct and add initial item pointer.
Definition: ILList.H:85
A helper class when constructing from an Istream or dictionary.
Definition: INew.H:52
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Template class for intrusive linked lists.
Definition: UILList.H:70
const volScalarField & T
Namespace for OpenFOAM.