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 | Copyright (C) 2011-2015 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  void operator=(const ILList<LListBase, T>&);
130 
131 
132  // Istream operator
133 
134  //- Read List from Istream, discarding contents of existing List.
135  friend Istream& operator>> <LListBase, T>
136  (
137  Istream&,
139  );
140 };
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #ifdef NoRepository
150 # include "ILList.C"
151 #endif
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
ILList()
Null construct.
Definition: ILList.H:80
void clear()
Clear the contents of the list.
Definition: ILList.C:112
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Template class for intrusive linked lists.
Definition: ILList.H:50
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
~ILList()
Destructor.
Definition: ILList.C:72
A helper class when constructing from an Istream or dictionary.
Definition: INew.H:49
bool eraseHead()
Remove the head element specified from the list and delete it.
Definition: ILList.C:81
Namespace for OpenFOAM.
void transfer(ILList< LListBase, T > &)
Transfer the contents of the argument into this List.
Definition: ILList.C:125
void operator=(const ILList< LListBase, T > &)
Definition: ILList.C:135
volScalarField & p
Definition: createFields.H:51
bool erase(T *p)
Remove the specified element from the list and delete it.
Definition: ILList.C:96
Template class for intrusive linked lists.
Definition: UILList.H:51