1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 inline label UPtrList<T>::size() const
44 inline bool UPtrList<T>::set(const label i) const
46 return ptrs_[i] != NULL;
51 inline T* UPtrList<T>::set(const label i, T* ptr)
59 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
62 const T& UPtrList<T>::operator[](const label i) const
66 FatalErrorIn("UPtrList::operator[] const")
67 << "hanging pointer, cannot dereference"
76 T& UPtrList<T>::operator[](const label i)
80 FatalErrorIn("UPtrList::operator[]")
81 << "hanging pointer, cannot dereference"
90 const T* UPtrList<T>::operator()(const label i) const
96 // * * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * //
99 inline UPtrList<T>::iterator::iterator(T** ptr)
105 inline bool UPtrList<T>::iterator::operator==(const iterator& iter) const
107 return ptr_ == iter.ptr_;
111 inline bool UPtrList<T>::iterator::operator!=(const iterator& iter) const
113 return ptr_ != iter.ptr_;
117 inline T& UPtrList<T>::iterator::operator*()
123 inline T& UPtrList<T>::iterator::operator()()
129 inline typename UPtrList<T>::iterator
130 UPtrList<T>::iterator::operator++()
137 inline typename UPtrList<T>::iterator
138 UPtrList<T>::iterator::operator++(int)
140 iterator tmp = *this;
146 inline typename UPtrList<T>::iterator
147 UPtrList<T>::iterator::operator--()
154 inline typename UPtrList<T>::iterator
155 UPtrList<T>::iterator::operator--(int)
157 iterator tmp = *this;
163 inline typename UPtrList<T>::iterator
164 UPtrList<T>::iterator::operator+=(label n)
171 inline typename UPtrList<T>::iterator
172 operator+(const typename UPtrList<T>::iterator& iter, label n)
174 typename UPtrList<T>::iterator tmp = iter;
179 inline typename UPtrList<T>::iterator
180 operator+(label n, const typename UPtrList<T>::iterator& iter)
182 typename UPtrList<T>::iterator tmp = iter;
187 inline typename UPtrList<T>::iterator
188 UPtrList<T>::iterator::operator-=(label n)
195 inline typename UPtrList<T>::iterator
196 operator-(const typename UPtrList<T>::iterator& iter, label n)
198 typename UPtrList<T>::iterator tmp = iter;
203 inline label operator-
205 const typename UPtrList<T>::iterator& iter1,
206 const typename UPtrList<T>::iterator& iter2
209 return (iter1.ptr_ - iter2.ptr_)/sizeof(T*);
213 inline T& UPtrList<T>::iterator::operator[](label n)
219 inline bool UPtrList<T>::iterator::operator<(const iterator& iter) const
221 return ptr_ < iter.ptr_;
225 inline bool UPtrList<T>::iterator::operator>(const iterator& iter) const
227 return ptr_ > iter.ptr_;
231 inline bool UPtrList<T>::iterator::operator<=(const iterator& iter) const
233 return ptr_ <= iter.ptr_;
237 inline bool UPtrList<T>::iterator::operator>=(const iterator& iter) const
239 return ptr_ >= iter.ptr_;
243 inline typename UPtrList<T>::iterator UPtrList<T>::begin()
245 return ptrs_.begin();
249 inline typename UPtrList<T>::iterator UPtrList<T>::end()
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 } // End namespace Foam
259 // ************************************************************************* //