1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #if defined(OSG_LINUX_ICC) && !defined(OSG_ICC_GNU_COMPAT)
40 # define MYFIRST _Myfirst
41 # define MYLAST _Mylast
43 #elif defined(OSG_SGI_CC)
44 # define MYFIRST _M_start
45 # define MYLAST _M_finish
46 # define MYEND _M_end_of_storage
47 #elif defined(OSG_LINUX_GCC)
48 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)
49 # define MYFIRST _M_impl._M_start
50 # define MYLAST _M_impl._M_finish
51 # define MYEND _M_impl._M_end_of_storage
53 # define MYFIRST _M_start
54 # define MYLAST _M_finish
55 # define MYEND _M_end_of_storage
57 #elif defined(__APPLE__)
58 # define MYFIRST _M_impl._M_start
59 # define MYLAST _M_impl._M_finish
60 # define MYEND _M_impl._M_end_of_storage
62 # define MYFIRST _Myfirst
63 # define MYLAST _Mylast
69 #if defined(__sgi) || defined(__linux) || defined(__APPLE__) || \
70 defined(__sun) || defined(__hpux)
72 template <class Tp, class Alloc> inline
73 MFieldVector<Tp, Alloc>::MFieldVector(const allocator_type& __a) :
78 template <class Tp, class Alloc> inline
79 MFieldVector<Tp, Alloc>::MFieldVector( size_type __n,
81 const allocator_type &__a ) :
82 Inherited(__n, __value, __a)
86 template <class Tp, class Alloc> inline
87 MFieldVector<Tp, Alloc>::MFieldVector(size_type __n) :
92 template <class Tp, class Alloc> inline
93 MFieldVector<Tp, Alloc>::MFieldVector(const std::vector<Tp, Alloc>& __x) :
98 template <class Tp, class Alloc> inline
99 MFieldVector<Tp, Alloc>::MFieldVector(const MFieldVector<Tp, Alloc>& __x) :
104 template <class Tp, class Alloc> inline
105 void MFieldVector<Tp, Alloc>::shareValues(Self &other, bool bDeleteOld)
107 #ifdef _LIBCPP_VERSION
110 if(bDeleteOld == true)
112 std::_Destroy(this->MYFIRST, this->MYLAST);
114 this->_M_deallocate(this->MYFIRST,
115 this->MYEND - this->MYFIRST);
118 this->MYFIRST = other.MYFIRST;
119 this->MYLAST = other.MYLAST;
120 this->MYEND = other.MYEND;
124 template <class Tp, class Alloc> inline
125 void MFieldVector<Tp, Alloc>::resolveShare(void)
127 #ifdef _LIBCPP_VERSION
130 this->MYFIRST = NULL;
137 void MFieldVector<bool>::resolveShare(void)
139 #ifdef _LIBCPP_VERSION
142 this->MYFIRST = Inherited::iterator();
143 this->MYLAST = this->MYFIRST;
148 #ifdef __STL_MEMBER_TEMPLATES
149 // Check whether it's an integral type. If so, it's not an iterator.
150 template <class Tp, class Alloc>
151 template <class InputIterator> inline
152 MFieldVector<Tp, Alloc>::MFieldVector( InputIterator __first,
153 InputIterator __last,
154 const allocator_type &__a ) :
155 Inherited(__first, __last, __a)
161 template <class Tp, class Alloc> inline
162 MFieldVector<Tp, Alloc>::MFieldVector(const Tp *__first,
164 const allocator_type &__a ) :
165 Inherited(__first, __last, __a)
169 #endif /* __STL_MEMBER_TEMPLATES */
171 template <class Tp, class Alloc> inline
172 MFieldVector<Tp, Alloc>::~MFieldVector()
176 template <class Tp, class Alloc> inline
177 void MFieldVector<Tp, Alloc>::dump(
179 const BitVector) const
182 for(UInt32 i = 0; i < uiIndent; ++i)
183 fprintf(stderr, " ");
185 fprintf(stderr, "first : %p | last : %p | end : %p\n",
194 template<class Ty, class A> inline
195 MFieldVector<Ty, A>::MFieldVector(const A &_Al) :
200 template<class Ty, class A> inline
201 MFieldVector<Ty, A>::MFieldVector( size_type _N,
204 Inherited(_N, _V, _Al)
208 template<class Ty, class A> inline
209 MFieldVector<Ty, A>::MFieldVector(const MFieldVector<Ty, A> &_X) :
215 template<class Ty, class A> inline
216 MFieldVector<Ty, A>::MFieldVector( It _F,
219 Inherited(_F, _L, _Al)
223 template<class Ty, class A> inline
224 MFieldVector<Ty, A>::~MFieldVector()
228 template<class Ty, class A> inline
229 void MFieldVector<Ty, A>::shareValues(Self &other, bool bDeleteOld)
232 if(bDeleteOld == true)
234 delete this->MYFIRST;
237 this->MYFIRST = other.MYFIRST;
238 this->MYLAST = other.MYLAST;
239 this->MYEND = other.MYEND;
245 template <class Tp, class A> inline
246 void MFieldVector<Tp, A>::resolveShare(void)
249 this->MYFIRST = NULL;
258 void MFieldVector<bool>::resolveShare(void)
261 this->MYFIRST = NULL;
266 // don't know how to do that right now (GV)
270 template <class Tp, class A> inline
271 void MFieldVector<Tp, A>::dump( UInt32 uiIndent,
272 const BitVector) const
275 for(UInt32 i = 0; i < uiIndent; ++i)
276 fprintf(stderr, " ");
278 fprintf(stderr, "first : %p | last : %p | end : %p\n",