ILList.H
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 Class
25  Foam::ILList
26 
27 Description
28  Template class for intrusive linked lists.
29 
30 SourceFiles
31  ILList.C
32  ILListIO.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef ILList_H
37 #define ILList_H
38 
39 #include "UILList.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 class Istream;
47 class Ostream;
48 
49 // Forward declaration of friend functions and operators
50 
51 template<class LListBase, class T> class ILList;
52 
53 template<class LListBase, class T> Istream& operator>>
54 (
55  Istream&,
57 );
58 
59 
60 /*---------------------------------------------------------------------------*\
61  Class ILList Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class LListBase, class T>
65 class ILList
66 :
67  public UILList<LListBase, T>
68 {
69  // Private Member Functions
70 
71  //- Read from Istream using given Istream constructor class
72  template<class INew>
73  void read(Istream&, const INew&);
74 
75 
76 public:
77 
78  // Constructors
79 
80  //- Null construct
81  ILList()
82  {}
83 
84  //- Construct given initial T
85  ILList(T* a)
86  :
87  UILList<LListBase, T>(a)
88  {}
89 
90  //- Construct from Istream
91  ILList(Istream&);
92 
93  //- Copy constructor
95 
96  //- Move constructor
98 
99  //- Copy constructor with additional argument for clone
100  template<class CloneArg>
101  ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg);
102 
103  //- Construct from Istream using given Istream constructor class
104  template<class INew>
105  ILList(Istream&, const INew&);
106 
107 
108  //- Destructor
109  ~ILList();
110 
111 
112  // Member Functions
113 
114  // Edit
115 
116  //- Remove the head element specified from the list and delete it
117  bool eraseHead();
118 
119  //- Remove the specified element from the list and delete it
120  bool erase(T* p);
121 
122  //- Clear the contents of the list
123  void clear();
124 
125  //- Transfer the contents of the argument into this List
126  // and annul the argument list.
128 
129 
130  // Member Operators
131 
132  //- Assignment operator
133  void operator=(const ILList<LListBase, T>&);
134 
135  //- Move assignment operator
137 
138 
139  // Istream operator
140 
141  //- Read List from Istream, discarding contents of existing List.
142  friend Istream& operator>> <LListBase, T>
143  (
144  Istream&,
146  );
147 };
148 
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace Foam
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #ifdef NoRepository
157  #include "ILList.C"
158 #endif
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
Template class for intrusive linked lists.
Definition: ILList.H:50
Template class for intrusive linked lists.
Definition: UILList.H:51
void transfer(ILList< LListBase, T > &)
Transfer the contents of the argument into this List.
Definition: ILList.C:130
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool erase(T *p)
Remove the specified element from the list and delete it.
Definition: ILList.C:101
ILList()
Null construct.
Definition: ILList.H:80
bool eraseHead()
Remove the head element specified from the list and delete it.
Definition: ILList.C:86
void clear()
Clear the contents of the list.
Definition: ILList.C:117
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A helper class when constructing from an Istream or dictionary.
Definition: INew.H:49
volScalarField & p
~ILList()
Destructor.
Definition: ILList.C:77
void operator=(const ILList< LListBase, T > &)
Assignment operator.
Definition: ILList.C:140
Namespace for OpenFOAM.