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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::ILList
29 
30 Description
31  Template class for intrusive linked lists.
32 
33 SourceFiles
34  ILList.C
35  ILListIO.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef ILList_H
40 #define ILList_H
41 
42 #include "UILList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 
51 class Istream;
52 class Ostream;
53 template<class LListBase, class T> class ILList;
54 
55 template<class LListBase, class T> Istream& operator>>
56 (
57  Istream& is,
59 );
60 
61 
62 /*---------------------------------------------------------------------------*\
63  Class ILList Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class LListBase, class T>
67 class 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 
78 public:
79 
80  // Constructors
81 
82  //- Default construct
83  ILList() = default;
84 
85  //- Construct and insert the initial T item pointer
86  explicit ILList(T* item)
87  :
88  UILList<LListBase, T>(item)
89  {}
90 
91  //- Construct from Istream
92  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.
126  void transfer(ILList<LListBase, T>& lst);
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
135  void operator=(ILList<LListBase, T>&& lst);
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 // ************************************************************************* //
UILList.H
Foam::ILList::eraseHead
bool eraseHead()
Remove the head element specified from the list and delete it.
Definition: ILList.C:83
Foam::ILList::ILList
ILList(T *item)
Construct and insert the initial T item pointer.
Definition: ILList.H:85
Foam::INew
A helper class when constructing from an Istream or dictionary.
Definition: INew.H:51
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::ILList::clear
void clear()
Clear the contents of the list.
Definition: ILList.C:112
Foam::ILList
Template class for intrusive linked lists.
Definition: ILList.H:52
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ILList::ILList
ILList()=default
Default construct.
Foam::ILList::~ILList
~ILList()
Destructor.
Definition: ILList.C:74
ILListIO.C
ILList.C
Foam::ILList::erase
bool erase(T *item)
Remove the specified element from the list and delete it.
Definition: ILList.C:97
Foam::UILList
Template class for intrusive linked lists.
Definition: UILList.H:52
Foam::ILList::operator=
void operator=(const ILList< LListBase, T > &lst)
Copy assignment using the 'clone()' method for each element.
Definition: ILList.C:136
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::ILList::transfer
void transfer(ILList< LListBase, T > &lst)
Definition: ILList.C:126