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