1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2003 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 #ifndef _OSGMFIELDVECTOR_H_
40 #define _OSGMFIELDVECTOR_H_
45 #include "OSGConfig.h"
52 #if defined(__sgi) || defined(__linux) || defined(__APPLE__) || \
53 defined(__sun) || defined(__hpux)
59 #if defined(__linux) || defined(__hpux) || defined(__APPLE__) || defined(__sun)
60 # if defined(__GNUC__)
62 # define OSG_STL_ALLOCATOR_DEFAULT(TP) = std::allocator<TP>
64 # elif defined (__ICL)
65 # define OSG_STL_ALLOCATOR_DEFAULT(TP) = std::allocator<TP>
66 # elif defined (OSG_HPUX_ACC)
67 # define OSG_STL_ALLOCATOR_DEFAULT(TP) _RWSTD_COMPLEX_DEFAULT(std::allocator<TP>)
68 # elif defined(OSG_SUN_CC)
69 # define OSG_STL_ALLOCATOR_DEFAULT(TP) _RWSTD_COMPLEX_DEFAULT(std::allocator<TP>)
71 # define OSG_STL_ALLOCATOR_DEFAULT(TP) = std::__STL_DEFAULT_ALLOCATOR(TP)
74 # define OSG_STL_ALLOCATOR_DEFAULT(TP) = std::__STL_DEFAULT_ALLOCATOR(TP)
77 /*! \ingroup GrpBaseField
78 \ingroup GrpBaseFieldMulti
79 \ingroup GrpLibOSGBase
83 template <class Tp
, class Alloc
OSG_STL_ALLOCATOR_DEFAULT(Tp
) >
84 class MFieldVector
: public std::vector
<Tp
, Alloc
>
88 typedef std::vector
<Tp
, Alloc
> Inherited
;
92 typedef MFieldVector
<Tp
, Alloc
> Self
;
96 typedef typename
Inherited::allocator_type allocator_type
;
97 typedef typename
Inherited::size_type size_type
;
99 explicit MFieldVector(const allocator_type
& __a
= allocator_type());
101 MFieldVector( size_type __n
,
103 const allocator_type
&__a
= allocator_type());
105 explicit MFieldVector(size_type __n
);
107 MFieldVector(const std::vector
<Tp
, Alloc
>& __x
);
108 MFieldVector(const MFieldVector
<Tp
, Alloc
>& __x
);
110 #ifdef __STL_MEMBER_TEMPLATES
111 // Check whether it's an integral type. If so, it's not an iterator.
112 template <class InputIterator
>
113 MFieldVector( InputIterator __first
,
114 InputIterator __last
,
115 const allocator_type
&__a
= allocator_type());
117 MFieldVector(const Tp
*__first
,
119 const allocator_type
&__a
= allocator_type());
120 #endif /* __STL_MEMBER_TEMPLATES */
124 void shareValues (Self
&other
, bool bDeleteOld
);
125 void resolveShare(void );
127 void dump( UInt32 uiIndent
= 0,
128 const BitVector bvFlags
= 0) const;
132 #pragma reset woff 1375
137 /*! \ingroup GrpBaseField
138 \ingroup GrpBaseFieldMulti
139 \ingroup GrpLibOSGBase
143 #define OSG_STL_ALLOCATOR_DEFAULT(TP) = std::allocator< TP >
145 template<class Ty
, class A
= std::allocator
<Ty
> >
146 class MFieldVector
: public std::vector
<Ty
, A
>
150 typedef std::vector
<Ty
, A
> Inherited
;
154 typedef typename
Inherited::const_iterator It
;
156 typedef MFieldVector
<Ty
, A
> Self
;
160 typedef typename
Inherited::allocator_type allocator_type
;
161 typedef typename
Inherited::size_type size_type
;
163 explicit MFieldVector(const A
& _Al
= A());
165 explicit MFieldVector( size_type _N
,
167 const A
&_Al
= A ());
169 MFieldVector(const MFieldVector
<Ty
, A
> &_X
);
178 void shareValues (Self
&other
, bool bDeleteOld
);
179 void resolveShare(void );
181 void dump( UInt32 uiIndent
= 0,
182 const BitVector bvFlags
= 0) const;
189 #include "OSGMFieldVector.inl"
191 #endif /* _OSGMFIELDVECTOR_H_ */