UPtrList.H
Go to the documentation of this file.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
00038
00039
00040
00041
00042 #ifndef UPtrList_H
00043 #define UPtrList_H
00044
00045 #include "List.H"
00046
00047
00048
00049 namespace Foam
00050 {
00051
00052
00053
00054 template<class T> class UPtrList;
00055
00056 template<class T>
00057 inline typename UPtrList<T>::iterator operator+
00058 (
00059 const typename UPtrList<T>::iterator&,
00060 label
00061 );
00062
00063 template<class T>
00064 inline typename UPtrList<T>::iterator operator+
00065 (
00066 label,
00067 const typename UPtrList<T>::iterator&
00068 );
00069
00070 template<class T>
00071 inline typename UPtrList<T>::iterator operator-
00072 (
00073 const typename UPtrList<T>::iterator&,
00074 label
00075 );
00076
00077 template<class T>
00078 inline label operator-
00079 (
00080 const typename UPtrList<T>::iterator&,
00081 const typename UPtrList<T>::iterator&
00082 );
00083
00084 template<class T>
00085 Istream& operator>>(Istream&, UPtrList<T>&);
00086
00087 template<class T>
00088 Ostream& operator<<(Ostream&, const UPtrList<T>&);
00089
00090
00091
00092
00093
00094
00095 template<class T>
00096 class UPtrList
00097 {
00098
00099
00100 List<T*> ptrs_;
00101
00102
00103 public:
00104
00105
00106
00107
00108 UPtrList();
00109
00110
00111 explicit UPtrList(const label);
00112
00113
00114 UPtrList(const Xfer<UPtrList<T> >&);
00115
00116
00117 UPtrList(UPtrList<T>&, bool reUse);
00118
00119
00120
00121
00122
00123
00124
00125 inline label size() const;
00126
00127
00128 inline bool empty() const;
00129
00130
00131
00132
00133
00134
00135
00136 void setSize(const label);
00137
00138
00139
00140
00141 inline void resize(const label);
00142
00143
00144 void clear();
00145
00146
00147
00148 void transfer(UPtrList<T>&);
00149
00150
00151 inline Xfer<UPtrList<T> > xfer();
00152
00153
00154 inline bool set(const label) const;
00155
00156
00157
00158 inline T* set(const label, T*);
00159
00160
00161
00162
00163 void reorder(const UList<label>&);
00164
00165
00166
00167
00168
00169 inline const T& operator[](const label) const;
00170
00171
00172 inline T& operator[](const label);
00173
00174
00175 inline const T* operator()(const label) const;
00176
00177
00178
00179
00180
00181 typedef T value_type;
00182
00183
00184 typedef T& reference;
00185
00186
00187
00188 typedef const T& const_reference;
00189
00190
00191
00192
00193
00194 class iterator;
00195 friend class iterator;
00196
00197
00198 class iterator
00199 {
00200 T** ptr_;
00201
00202 public:
00203
00204
00205 inline iterator(T**);
00206
00207
00208
00209 inline bool operator==(const iterator&) const;
00210 inline bool operator!=(const iterator&) const;
00211
00212 inline T& operator*();
00213 inline T& operator()();
00214
00215 inline iterator operator++();
00216 inline iterator operator++(int);
00217
00218 inline iterator operator--();
00219 inline iterator operator--(int);
00220
00221 inline iterator operator+=(label);
00222
00223 friend iterator operator+ <T>(const iterator&, label);
00224 friend iterator operator+ <T>(label, const iterator&);
00225
00226 inline iterator operator-=(label);
00227
00228 friend iterator operator- <T>(const iterator&, label);
00229
00230 friend label operator- <T>
00231 (
00232 const iterator&,
00233 const iterator&
00234 );
00235
00236 inline T& operator[](label);
00237
00238 inline bool operator<(const iterator&) const;
00239 inline bool operator>(const iterator&) const;
00240
00241 inline bool operator<=(const iterator&) const;
00242 inline bool operator>=(const iterator&) const;
00243 };
00244
00245
00246 inline iterator begin();
00247
00248
00249 inline iterator end();
00250
00251
00252
00253
00254
00255 friend Ostream& operator<< <T>(Ostream&, const UPtrList<T>&);
00256 };
00257
00258
00259
00260
00261 }
00262
00263
00264
00265 # include "UPtrListI.H"
00266
00267
00268
00269 #ifdef NoRepository
00270 # include "UPtrList.C"
00271 #endif
00272
00273
00274
00275 #endif
00276
00277
Copyright © 2000-2009 OpenCFD Ltd