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 UILList_H
00038 #define UILList_H
00039
00040 #include "label.H"
00041
00042
00043
00044 namespace Foam
00045 {
00046
00047 class Ostream;
00048
00049
00050
00051 template<class LListBase, class T>
00052 class UILList;
00053
00054 template<class LListBase, class T>
00055 Ostream& operator<<
00056 (
00057 Ostream&,
00058 const UILList<LListBase, T>&
00059 );
00060
00061
00062
00063
00064
00065
00066 template<class LListBase, class T>
00067 class UILList
00068 :
00069 public LListBase
00070 {
00071
00072 public:
00073
00074
00075
00076 class iterator;
00077 friend class iterator;
00078
00079 class const_iterator;
00080 friend class const_iterator;
00081
00082
00083
00084
00085
00086 UILList()
00087 {}
00088
00089
00090 UILList(T* a)
00091 :
00092 LListBase(a)
00093 {}
00094
00095
00096 UILList(const UILList<LListBase, T>&);
00097
00098
00099
00100
00101
00102
00103
00104 T* first()
00105 {
00106 return static_cast<T*>(LListBase::first());
00107 }
00108
00109
00110 const T* first() const
00111 {
00112 return static_cast<const T*>(LListBase::first());
00113 }
00114
00115
00116 T* last()
00117 {
00118 return static_cast<T*>(LListBase::last());
00119 }
00120
00121
00122 const T* last() const
00123 {
00124 return static_cast<const T*>(LListBase::last());
00125 }
00126
00127
00128
00129
00130
00131 T* removeHead()
00132 {
00133 return static_cast<T*>(LListBase::removeHead());
00134 }
00135
00136
00137 T* remove(T* p)
00138 {
00139 return static_cast<T*>(LListBase::remove(p));
00140 }
00141
00142
00143 T* remove(iterator& it)
00144 {
00145 return static_cast<T*>(LListBase::remove(it));
00146 }
00147
00148
00149
00150
00151 void operator=(const UILList<LListBase, T>&);
00152
00153
00154
00155
00156
00157 typedef T value_type;
00158
00159
00160
00161 typedef T& reference;
00162
00163
00164
00165 typedef const T& const_reference;
00166
00167
00168 typedef label size_type;
00169
00170
00171
00172
00173 typedef typename LListBase::iterator LListBase_iterator;
00174
00175 class iterator
00176 :
00177 public LListBase_iterator
00178 {
00179
00180 public:
00181
00182
00183 iterator
00184 (
00185 LListBase_iterator baseIter
00186 )
00187 :
00188 LListBase_iterator(baseIter)
00189 {}
00190
00191
00192
00193
00194 T& operator*()
00195 {
00196 return static_cast<T&>(LListBase_iterator::operator*());
00197 }
00198
00199 T& operator()()
00200 {
00201 return operator*();
00202 }
00203
00204 iterator& operator++()
00205 {
00206 LListBase_iterator::operator++();
00207 return *this;
00208 }
00209 };
00210
00211
00212
00213
00214 typedef typename LListBase::const_iterator LListBase_const_iterator;
00215
00216 class const_iterator
00217 :
00218 public LListBase_const_iterator
00219 {
00220
00221 public:
00222
00223
00224 const_iterator
00225 (
00226 LListBase_const_iterator baseIter
00227 )
00228 :
00229 LListBase_const_iterator(baseIter)
00230 {}
00231
00232
00233 const_iterator
00234 (
00235 LListBase_iterator baseIter
00236 )
00237 :
00238 LListBase_const_iterator(baseIter)
00239 {}
00240
00241
00242
00243
00244 const T& operator*()
00245 {
00246 return
00247 static_cast<const T&>
00248 (LListBase_const_iterator::operator*());
00249 }
00250
00251 const T& operator()()
00252 {
00253 return operator*();
00254 }
00255
00256 const_iterator& operator++()
00257 {
00258 LListBase_const_iterator::operator++();
00259 return *this;
00260 }
00261 };
00262
00263
00264
00265
00266
00267
00268
00269 bool operator==(const UILList<LListBase, T>&) const;
00270
00271
00272 bool operator!=(const UILList<LListBase, T>&) const;
00273
00274
00275
00276
00277 friend Ostream& operator<< <LListBase, T>
00278 (
00279 Ostream&,
00280 const UILList<LListBase, T>&
00281 );
00282 };
00283
00284
00285
00286
00287 }
00288
00289
00290
00291 #ifdef NoRepository
00292 # include "UILList.C"
00293 #endif
00294
00295
00296
00297 #endif
00298
00299
Copyright © 2000-2007 OpenCFD Ltd