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-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 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  //- Construct as copy
95 
96  //- Copy constructor with additional argument for clone
97  template<class CloneArg>
98  ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg);
99 
100  //- Construct from Istream using given Istream constructor class
101  template<class INew>
102  ILList(Istream&, const INew&);
103 
104 
105  //- Destructor
106  ~ILList();
107 
108 
109  // Member Functions
110 
111  // Edit
112 
113  //- Remove the head element specified from the list and delete it
114  bool eraseHead();
115 
116  //- Remove the specified element from the list and delete it
117  bool erase(T* p);
118 
119  //- Clear the contents of the list
120  void clear();
121 
122  //- Transfer the contents of the argument into this List
123  // and annul the argument list.
125 
126 
127  // Member operators
128 
129  //- Assignment operator
130  void operator=(const ILList<LListBase, T>&);
131 
132 
133  // Istream operator
134 
135  //- Read List from Istream, discarding contents of existing List.
136  friend Istream& operator>> <LListBase, T>
137  (
138  Istream&,
140  );
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #ifdef NoRepository
151  #include "ILList.C"
152 #endif
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #endif
157 
158 // ************************************************************************* //
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:125
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:96
ILList()
Null construct.
Definition: ILList.H:80
bool eraseHead()
Remove the head element specified from the list and delete it.
Definition: ILList.C:81
void clear()
Clear the contents of the list.
Definition: ILList.C:112
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:72
void operator=(const ILList< LListBase, T > &)
Assignment operator.
Definition: ILList.C:135
Namespace for OpenFOAM.