changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / Base / Field / OSGMFieldVector.h
blob84676b9509535e62ef5467f9f5ea95966af4286f
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2003 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGMFIELDVECTOR_H_
40 #define _OSGMFIELDVECTOR_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGConfig.h"
47 #include <vector>
49 OSG_BEGIN_NAMESPACE
52 #if defined(__sgi) || defined(__linux) || defined(__APPLE__) || \
53 defined(__sun) || defined(__hpux)
55 #if defined(__sgi)
56 #pragma set woff 1375
57 #endif
59 #if defined(__linux) || defined(__hpux) || defined(__APPLE__) || defined(__sun)
60 # if defined(__GNUC__)
61 # if __GNUC__ >= 3
62 # define OSG_STL_ALLOCATOR_DEFAULT(TP) = std::allocator<TP>
63 # endif
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>)
70 # else
71 # define OSG_STL_ALLOCATOR_DEFAULT(TP) = std::__STL_DEFAULT_ALLOCATOR(TP)
72 # endif
73 #else
74 # define OSG_STL_ALLOCATOR_DEFAULT(TP) = std::__STL_DEFAULT_ALLOCATOR(TP)
75 #endif
77 /*! \ingroup GrpBaseField
78 \ingroup GrpBaseFieldMulti
79 \ingroup GrpLibOSGBase
80 \nohierarchy
83 template <class Tp, class Alloc OSG_STL_ALLOCATOR_DEFAULT(Tp) >
84 class MFieldVector : public std::vector<Tp, Alloc>
86 public:
88 typedef std::vector<Tp, Alloc> Inherited;
90 private:
92 typedef MFieldVector<Tp, Alloc> Self;
94 public:
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,
102 const Tp &__value,
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());
116 #else
117 MFieldVector(const Tp *__first,
118 const Tp *__last,
119 const allocator_type &__a = allocator_type());
120 #endif /* __STL_MEMBER_TEMPLATES */
122 ~MFieldVector();
124 void shareValues (Self &other, bool bDeleteOld);
125 void resolveShare(void );
127 void dump( UInt32 uiIndent = 0,
128 const BitVector bvFlags = 0) const;
131 #if defined(__sgi)
132 #pragma reset woff 1375
133 #endif
135 #elif defined(WIN32)
137 /*! \ingroup GrpBaseField
138 \ingroup GrpBaseFieldMulti
139 \ingroup GrpLibOSGBase
140 \nohierarchy
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>
148 public:
150 typedef std::vector<Ty, A> Inherited;
152 private :
154 typedef typename Inherited::const_iterator It;
156 typedef MFieldVector<Ty, A> Self;
158 public :
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,
166 const Ty &_V = Ty(),
167 const A &_Al = A ());
169 MFieldVector(const MFieldVector<Ty, A> &_X);
172 MFieldVector( It _F,
173 It _L,
174 const A &_Al = A());
176 ~MFieldVector(void);
178 void shareValues (Self &other, bool bDeleteOld);
179 void resolveShare(void );
181 void dump( UInt32 uiIndent = 0,
182 const BitVector bvFlags = 0) const;
185 #endif
187 OSG_END_NAMESPACE
189 #include "OSGMFieldVector.inl"
191 #endif /* _OSGMFIELDVECTOR_H_ */