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 if(bDeleteOld == true)
109 std::_Destroy(this->MYFIRST, this->MYLAST);
111 this->_M_deallocate(this->MYFIRST,
112 this->MYEND - this->MYFIRST);
115 this->MYFIRST = other.MYFIRST;
116 this->MYLAST = other.MYLAST;
117 this->MYEND = other.MYEND;
120 template <class Tp, class Alloc> inline
121 void MFieldVector<Tp, Alloc>::resolveShare(void)
123 this->MYFIRST = NULL;
129 void MFieldVector<bool>::resolveShare(void)
131 this->MYFIRST = Inherited::iterator();
132 this->MYLAST = this->MYFIRST;
136 #ifdef __STL_MEMBER_TEMPLATES
137 // Check whether it's an integral type. If so, it's not an iterator.
138 template <class Tp, class Alloc>
139 template <class InputIterator> inline
140 MFieldVector<Tp, Alloc>::MFieldVector( InputIterator __first,
141 InputIterator __last,
142 const allocator_type &__a ) :
143 Inherited(__first, __last, __a)
149 template <class Tp, class Alloc> inline
150 MFieldVector<Tp, Alloc>::MFieldVector(const Tp *__first,
152 const allocator_type &__a ) :
153 Inherited(__first, __last, __a)
157 #endif /* __STL_MEMBER_TEMPLATES */
159 template <class Tp, class Alloc> inline
160 MFieldVector<Tp, Alloc>::~MFieldVector()
164 template <class Tp, class Alloc> inline
165 void MFieldVector<Tp, Alloc>::dump(
167 const BitVector) const
169 for(UInt32 i = 0; i < uiIndent; ++i)
170 fprintf(stderr, " ");
172 fprintf(stderr, "first : %p | last : %p | end : %p\n",
180 template<class Ty, class A> inline
181 MFieldVector<Ty, A>::MFieldVector(const A &_Al) :
186 template<class Ty, class A> inline
187 MFieldVector<Ty, A>::MFieldVector( size_type _N,
190 Inherited(_N, _V, _Al)
194 template<class Ty, class A> inline
195 MFieldVector<Ty, A>::MFieldVector(const MFieldVector<Ty, A> &_X) :
201 template<class Ty, class A> inline
202 MFieldVector<Ty, A>::MFieldVector( It _F,
205 Inherited(_F, _L, _Al)
209 template<class Ty, class A> inline
210 MFieldVector<Ty, A>::~MFieldVector()
214 template<class Ty, class A> inline
215 void MFieldVector<Ty, A>::shareValues(Self &other, bool bDeleteOld)
217 if(bDeleteOld == true)
219 delete this->MYFIRST;
222 this->MYFIRST = other.MYFIRST;
223 this->MYLAST = other.MYLAST;
224 this->MYEND = other.MYEND;
227 template <class Tp, class A> inline
228 void MFieldVector<Tp, A>::resolveShare(void)
230 this->MYFIRST = NULL;
236 void MFieldVector<bool>::resolveShare(void)
239 this->MYFIRST = NULL;
244 // don't know how to do that right now (GV)
248 template <class Tp, class A> inline
249 void MFieldVector<Tp, A>::dump( UInt32 uiIndent,
250 const BitVector) const
252 for(UInt32 i = 0; i < uiIndent; ++i)
253 fprintf(stderr, " ");
255 fprintf(stderr, "first : %p | last : %p | end : %p\n",