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