00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef LPtrList_H
00038 #define LPtrList_H
00039
00040 #include "LList.H"
00041
00042
00043
00044 namespace Foam
00045 {
00046
00047
00048
00049 template<class LListBase, class T> class LPtrList;
00050
00051 template<class LListBase, class T>
00052 Istream& operator>>
00053 (
00054 Istream&,
00055 LPtrList<LListBase, T>&
00056 );
00057
00058 template<class LListBase, class T>
00059 Ostream& operator<<
00060 (
00061 Ostream&,
00062 const LPtrList<LListBase, T>&
00063 );
00064
00065
00066
00067
00068
00069
00070 template<class LListBase, class T>
00071 class LPtrList
00072 :
00073 public LList<LListBase, T*>
00074 {
00075
00076
00077
00078 template<class INew>
00079 void read(Istream&, const INew& inewt);
00080
00081
00082 public:
00083
00084
00085
00086 class iterator;
00087 friend class iterator;
00088
00089 class const_iterator;
00090 friend class const_iterator;
00091
00092
00093
00094
00095
00096 LPtrList()
00097 {}
00098
00099
00100 LPtrList(T* a)
00101 :
00102 LList<LListBase, T*>(a)
00103 {}
00104
00105
00106 template<class INew>
00107 LPtrList(Istream&, const INew&);
00108
00109
00110 LPtrList(Istream&);
00111
00112
00113 LPtrList(const LPtrList&);
00114
00115
00116
00117
00118 ~LPtrList();
00119
00120
00121
00122
00123
00124
00125
00126 T& first()
00127 {
00128 return *LList<LListBase, T*>::first();
00129 }
00130
00131
00132 const T& first() const
00133 {
00134 return *LList<LListBase, T*>::first();
00135 }
00136
00137
00138 T& last()
00139 {
00140 return *LList<LListBase, T*>::last();
00141 }
00142
00143
00144 const T& last() const
00145 {
00146 return *LList<LListBase, T*>::last();
00147 }
00148
00149
00150
00151
00152
00153 bool eraseHead();
00154
00155
00156 void clear();
00157
00158
00159
00160
00161
00162 void operator=(const LPtrList<LListBase, T>&);
00163
00164
00165
00166
00167
00168
00169 typedef T& reference;
00170
00171
00172
00173 typedef T& const_reference;
00174
00175
00176
00177
00178 typedef typename LListBase::iterator LListBase_iterator;
00179
00180 class iterator
00181 :
00182 public LList<LListBase, T*>::iterator
00183 {
00184
00185 public:
00186
00187
00188 iterator
00189 (
00190 LListBase_iterator baseIter
00191 )
00192 :
00193 LList<LListBase, T*>::iterator(baseIter)
00194 {}
00195
00196
00197
00198
00199 T& operator*()
00200 {
00201 return *(LList<LListBase, T*>::iterator::operator*());
00202 }
00203
00204 T& operator()()
00205 {
00206 return operator*();
00207 }
00208 };
00209
00210
00211
00212
00213 typedef typename LListBase::const_iterator LListBase_const_iterator;
00214
00215 class const_iterator
00216 :
00217 public LList<LListBase, T*>::const_iterator
00218 {
00219
00220 public:
00221
00222
00223 const_iterator
00224 (
00225 LListBase_const_iterator baseIter
00226 )
00227 :
00228 LList<LListBase, T*>::const_iterator(baseIter)
00229 {}
00230
00231
00232 const_iterator
00233 (
00234 LListBase_iterator baseIter
00235 )
00236 :
00237 LList<LListBase, T*>::const_iterator(baseIter)
00238 {}
00239
00240
00241
00242
00243 const T& operator*()
00244 {
00245 return *(LList<LListBase, T*>::const_iterator::operator*());
00246 }
00247
00248 const T& operator()()
00249 {
00250 return operator*();
00251 }
00252 };
00253
00254
00255
00256
00257 friend Istream& operator>> <LListBase, T>
00258 (
00259 Istream&,
00260 LPtrList<LListBase, T>&
00261 );
00262
00263 friend Ostream& operator<< <LListBase, T>
00264 (
00265 Ostream&,
00266 const LPtrList<LListBase, T>&
00267 );
00268 };
00269
00270
00271
00272
00273 }
00274
00275
00276
00277 #ifdef NoRepository
00278 # include "LPtrList.C"
00279 #endif
00280
00281
00282
00283 #endif
00284
00285