changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / Base / Field / OSGTypeInst.cpp
blobabb4677e30bd5eb204cb288d13e09178eb5636c5
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 #define OSG_COMPILEFIELDINST
41 #include "OSGField.h"
43 #include "OSGSField.h"
44 #include "OSGSField.ins"
46 #include "OSGMField.h"
47 #include "OSGMField.ins"
49 #include "OSGBaseSFields.h"
50 #include "OSGBaseMFields.h"
52 #include "OSGSysSFields.h"
53 #include "OSGSysMFields.h"
55 #include "OSGMathSFields.h"
56 #include "OSGMathMFields.h"
58 #include "OSGVecSFields.h"
59 #include "OSGVecMFields.h"
61 #include "OSGFieldContainer.h"
63 OSG_BEGIN_NAMESPACE
65 namespace
67 // Type objects for "abstract" types in the type hierarchy.
68 // These types do not correspond with any real types, but are used to
69 // group the concrete types.
70 DataType typeObjTypeRoot ("TypeRoot", NULL );
71 DataType typeObjBaseType ("BaseType", "TypeRoot");
72 DataType typeObjIntegralType("IntegralType", "TypeRoot");
73 DataType typeObjField ("Field", "TypeRoot");
77 DataType FieldTraits<bool, 2 >::_type("bool" , "IntegralType");
78 DataType FieldTraits< Int8 >::_type("Int8" , "IntegralType");
79 DataType FieldTraits<UInt8 >::_type("UInt8" , "IntegralType");
80 DataType FieldTraits< Int16 >::_type("Int16" , "IntegralType");
81 DataType FieldTraits<UInt16 >::_type("UInt16", "IntegralType");
82 DataType FieldTraits< Int32 >::_type("Int32" , "IntegralType");
83 DataType FieldTraits<UInt32 >::_type("UInt32", "IntegralType");
84 DataType FieldTraits< Int64 >::_type("Int64" , "IntegralType");
85 DataType FieldTraits<UInt64 >::_type("UInt64", "IntegralType");
86 DataType FieldTraits<Real16 >::_type("Real16", "IntegralType");
87 DataType FieldTraits<Real32 >::_type("Real32", "IntegralType");
88 DataType FieldTraits<Fixed32 >::_type("Fixed32", "IntegralType");
89 DataType FieldTraits<Real64 >::_type("Real64", "IntegralType");
90 DataType FieldTraits<void * >::_type("VoidP" , "IntegralType");
92 DataType FieldTraits<Color3f >::_type("Color3f", "BaseType" );
93 DataType FieldTraits<Color3fx >::_type("Color3fx", "BaseType" );
94 DataType FieldTraits<Color4f >::_type("Color4f", "BaseType" );
95 DataType FieldTraits<Color4fx >::_type("Color4fx", "BaseType" );
96 DataType FieldTraits<Color3ub >::_type("Color3ub", "BaseType" );
97 DataType FieldTraits<Color4ub >::_type("Color4ub", "BaseType" );
98 DataType FieldTraits<std::string >::_type("string", "BaseType" );
99 DataType FieldTraits<Time, 1 >::_type("Time", "BaseType" );
100 DataType FieldTraits<BoxVolume >::_type("BoxVolume", "BaseType" );
101 DataType FieldTraits<BitVector, 1 >::_type("BitVector", "BaseType" );
102 DataType FieldTraits<GLenum, 1 >::_type("GLenum", "BaseType" );
103 DataType FieldTraits<Plane >::_type("Plane", "BaseType" );
105 DataType FieldTraits<Vec1ub >::_type("Vec1ub", "BaseType" );
106 #ifndef OSG_NO_INT8_PNT
107 DataType FieldTraits<Vec1b >::_type("Vec1b" , "BaseType" );
108 #endif
109 DataType FieldTraits<Vec1us >::_type("Vec1us", "BaseType" );
110 DataType FieldTraits<Vec1s >::_type("Vec1s" , "BaseType" );
111 DataType FieldTraits<Vec1u >::_type("Vec1u", "BaseType" );
112 DataType FieldTraits<Vec1i >::_type("Vec1i" , "BaseType" );
113 DataType FieldTraits<Vec1f >::_type("Vec1f" , "BaseType" );
114 DataType FieldTraits<Vec1fx >::_type("Vec1fx", "BaseType" );
115 DataType FieldTraits<Vec1d >::_type("Vec1d" , "BaseType" );
116 DataType FieldTraits<Vec1ld >::_type("Vec1ld", "BaseType" );
118 #ifndef OSG_DOXYGEN_REC_MACRO_PROBS
119 DataType FieldTraits<Vec2ub >::_type("Vec2ub", "BaseType" );
120 #ifndef OSG_NO_INT8_PNT
121 DataType FieldTraits<Vec2b >::_type("Vec2b" , "BaseType" );
122 #endif
123 DataType FieldTraits<Vec2us >::_type("Vec2us", "BaseType" );
124 DataType FieldTraits<Vec2s >::_type("Vec2s" , "BaseType" );
125 DataType FieldTraits<Vec2u >::_type("Vec2u", "BaseType" );
126 DataType FieldTraits<Vec2i >::_type("Vec2i" , "BaseType" );
127 DataType FieldTraits<Vec2f >::_type("Vec2f" , "BaseType" );
128 DataType FieldTraits<Vec2fx >::_type("Vec2fx", "BaseType" );
129 DataType FieldTraits<Vec2d >::_type("Vec2d" , "BaseType" );
130 DataType FieldTraits<Vec2ld >::_type("Vec2ld", "BaseType" );
132 DataType FieldTraits<Vec3ub >::_type("Vec3ub", "BaseType" );
133 #ifndef OSG_NO_INT8_PNT
134 DataType FieldTraits<Vec3b >::_type("Vec3b" , "BaseType" );
135 #endif
136 DataType FieldTraits<Vec3us >::_type("Vec3us", "BaseType" );
137 DataType FieldTraits<Vec3s >::_type("Vec3s" , "BaseType" );
138 DataType FieldTraits<Vec3u >::_type("Vec3u", "BaseType" );
139 DataType FieldTraits<Vec3i >::_type("Vec3i" , "BaseType" );
140 DataType FieldTraits<Vec3f >::_type("Vec3f" , "BaseType" );
141 DataType FieldTraits<Vec3fx >::_type("Vec3fx", "BaseType" );
142 DataType FieldTraits<Vec3d >::_type("Vec3d" , "BaseType" );
143 DataType FieldTraits<Vec3ld >::_type("Vec3ld", "BaseType" );
145 DataType FieldTraits<Vec4ub >::_type("Vec4ub", "BaseType" );
146 #ifndef OSG_NO_INT8_PNT
147 DataType FieldTraits<Vec4b >::_type("Vec4b" , "BaseType" );
148 #endif
149 DataType FieldTraits<Vec4us >::_type("Vec4us", "BaseType" );
150 DataType FieldTraits<Vec4s >::_type("Vec4s" , "BaseType" );
151 DataType FieldTraits<Vec4u >::_type("Vec4u", "BaseType" );
152 DataType FieldTraits<Vec4i >::_type("Vec4i" , "BaseType" );
153 DataType FieldTraits<Vec4f >::_type("Vec4f" , "BaseType" );
154 DataType FieldTraits<Vec4fx >::_type("Vec4fx", "BaseType" );
155 DataType FieldTraits<Vec4d >::_type("Vec4d" , "BaseType" );
156 DataType FieldTraits<Vec4ld >::_type("Vec4ld", "BaseType" );
158 DataType FieldTraits<Pnt1ub >::_type("Pnt1ub", "BaseType" );
159 #ifndef OSG_NO_INT8_PNT
160 DataType FieldTraits<Pnt1b >::_type("Pnt1b" , "BaseType" );
161 #endif
162 DataType FieldTraits<Pnt1us >::_type("Pnt1us", "BaseType" );
163 DataType FieldTraits<Pnt1s >::_type("Pnt1s" , "BaseType" );
164 DataType FieldTraits<Pnt1f >::_type("Pnt1f" , "BaseType" );
165 DataType FieldTraits<Pnt1fx >::_type("Pnt1fx", "BaseType" );
166 DataType FieldTraits<Pnt1d >::_type("Pnt1d" , "BaseType" );
167 DataType FieldTraits<Pnt1ld >::_type("Pnt1ld", "BaseType" );
169 DataType FieldTraits<Pnt2ub >::_type("Pnt2ub", "BaseType" );
170 #ifndef OSG_NO_INT8_PNT
171 DataType FieldTraits<Pnt2b >::_type("Pnt2b" , "BaseType" );
172 #endif
173 DataType FieldTraits<Pnt2us >::_type("Pnt2us", "BaseType" );
174 DataType FieldTraits<Pnt2s >::_type("Pnt2s" , "BaseType" );
175 DataType FieldTraits<Pnt2f >::_type("Pnt2f" , "BaseType" );
176 DataType FieldTraits<Pnt2fx >::_type("Pnt2fx", "BaseType" );
177 DataType FieldTraits<Pnt2d >::_type("Pnt2d" , "BaseType" );
178 DataType FieldTraits<Pnt2ld >::_type("Pnt2ld", "BaseType" );
180 DataType FieldTraits<Pnt3ub >::_type("Pnt3ub", "BaseType" );
181 #ifndef OSG_NO_INT8_PNT
182 DataType FieldTraits<Pnt3b >::_type("Pnt3b" , "BaseType" );
183 #endif
184 DataType FieldTraits<Pnt3us >::_type("Pnt3us", "BaseType" );
185 DataType FieldTraits<Pnt3s >::_type("Pnt3s" , "BaseType" );
186 DataType FieldTraits<Pnt3f >::_type("Pnt3f" , "BaseType" );
187 DataType FieldTraits<Pnt3fx >::_type("Pnt3fx", "BaseType" );
188 DataType FieldTraits<Pnt3d >::_type("Pnt3d" , "BaseType" );
189 DataType FieldTraits<Pnt3ld >::_type("Pnt3ld", "BaseType" );
191 DataType FieldTraits<Pnt4ub >::_type("Pnt4ub", "BaseType" );
192 #ifndef OSG_NO_INT8_PNT
193 DataType FieldTraits<Pnt4b >::_type("Pnt4b" , "BaseType" );
194 #endif
195 DataType FieldTraits<Pnt4us >::_type("Pnt4us", "BaseType" );
196 DataType FieldTraits<Pnt4s >::_type("Pnt4s" , "BaseType" );
197 DataType FieldTraits<Pnt4f >::_type("Pnt4f" , "BaseType" );
198 DataType FieldTraits<Pnt4fx >::_type("Pnt4fx" , "BaseType" );
199 DataType FieldTraits<Pnt4d >::_type("Pnt4d" , "BaseType" );
200 DataType FieldTraits<Pnt4ld >::_type("Pnt4ld", "BaseType" );
201 #endif
203 DataType FieldTraits<Matrix >::_type("Matrix" , "BaseType" );
204 DataType FieldTraits<Matrix4d >::_type("Matrix4d" , "BaseType" );
205 DataType FieldTraits<Matrix4fx >::_type("Matrix4fx" , "BaseType" );
206 DataType FieldTraits<Quaternion >::_type("Quaternion", "BaseType" );
207 DataType FieldTraits<Quaternionfx >::_type("Quaternionfx", "BaseType" );
209 OSG_FIELDTRAITS_GETTYPE_NS(bool, 2)
210 OSG_FIELDTRAITS_GETTYPE ( Int8 )
211 OSG_FIELDTRAITS_GETTYPE (UInt8 )
212 OSG_FIELDTRAITS_GETTYPE ( Int16 )
213 OSG_FIELDTRAITS_GETTYPE (UInt16 )
214 OSG_FIELDTRAITS_GETTYPE ( Int32 )
215 OSG_FIELDTRAITS_GETTYPE (UInt32 )
216 OSG_FIELDTRAITS_GETTYPE ( Int64 )
217 OSG_FIELDTRAITS_GETTYPE (UInt64 )
218 OSG_FIELDTRAITS_GETTYPE (Real16 )
219 OSG_FIELDTRAITS_GETTYPE (Real32 )
220 OSG_FIELDTRAITS_GETTYPE (Fixed32 )
221 OSG_FIELDTRAITS_GETTYPE (Real64 )
222 OSG_FIELDTRAITS_GETTYPE (void * )
224 OSG_FIELDTRAITS_GETTYPE (Color3f )
225 OSG_FIELDTRAITS_GETTYPE (Color3fx )
226 OSG_FIELDTRAITS_GETTYPE (Color4f )
227 OSG_FIELDTRAITS_GETTYPE (Color4fx )
228 OSG_FIELDTRAITS_GETTYPE (Color3ub )
229 OSG_FIELDTRAITS_GETTYPE (Color4ub )
230 OSG_FIELDTRAITS_GETTYPE (std::string )
231 OSG_FIELDTRAITS_GETTYPE_NS(Time, 1)
232 OSG_FIELDTRAITS_GETTYPE (BoxVolume )
233 OSG_FIELDTRAITS_GETTYPE_NS(BitVector, 1)
234 OSG_FIELDTRAITS_GETTYPE_NS(GLenum, 1)
235 OSG_FIELDTRAITS_GETTYPE (Plane )
237 OSG_FIELDTRAITS_GETTYPE (Matrix )
238 OSG_FIELDTRAITS_GETTYPE (Matrix4d )
239 OSG_FIELDTRAITS_GETTYPE (Matrix4fx )
240 OSG_FIELDTRAITS_GETTYPE (Quaternion )
241 OSG_FIELDTRAITS_GETTYPE (Quaternionfx )
243 OSG_FIELD_DLLEXPORT_DEF2(SField, bool, 2)
244 OSG_FIELD_DLLEXPORT_DEF1(SField, Int8 )
245 OSG_FIELD_DLLEXPORT_DEF1(SField, UInt8 )
246 OSG_FIELD_DLLEXPORT_DEF1(SField, Int16 )
247 OSG_FIELD_DLLEXPORT_DEF1(SField, UInt16 )
248 OSG_FIELD_DLLEXPORT_DEF1(SField, Int32 )
249 OSG_FIELD_DLLEXPORT_DEF1(SField, UInt32 )
250 OSG_FIELD_DLLEXPORT_DEF1(SField, Int64 )
251 OSG_FIELD_DLLEXPORT_DEF1(SField, UInt64 )
252 OSG_FIELD_DLLEXPORT_DEF1(SField, Real16 )
253 OSG_FIELD_DLLEXPORT_DEF1(SField, Real32 )
254 OSG_FIELD_DLLEXPORT_DEF1(SField, Fixed32 )
255 OSG_FIELD_DLLEXPORT_DEF1(SField, Real64 )
256 OSG_FIELD_DLLEXPORT_DEF1(SField, void * )
258 OSG_FIELD_DLLEXPORT_DEF2(MField, bool, 2)
259 OSG_FIELD_DLLEXPORT_DEF1(MField, Int8 )
260 OSG_FIELD_DLLEXPORT_DEF1(MField, UInt8 )
261 OSG_FIELD_DLLEXPORT_DEF1(MField, Int16 )
262 OSG_FIELD_DLLEXPORT_DEF1(MField, UInt16 )
263 OSG_FIELD_DLLEXPORT_DEF1(MField, Int32 )
264 OSG_FIELD_DLLEXPORT_DEF1(MField, UInt32 )
265 OSG_FIELD_DLLEXPORT_DEF1(MField, Int64 )
266 OSG_FIELD_DLLEXPORT_DEF1(MField, UInt64 )
267 OSG_FIELD_DLLEXPORT_DEF1(MField, Real16 )
268 OSG_FIELD_DLLEXPORT_DEF1(MField, Real32 )
269 OSG_FIELD_DLLEXPORT_DEF1(MField, Fixed32 )
270 OSG_FIELD_DLLEXPORT_DEF1(MField, Real64 )
271 OSG_FIELD_DLLEXPORT_DEF1(MField, void * )
274 OSG_FIELD_DLLEXPORT_DEF1(SField, Color3f )
275 OSG_FIELD_DLLEXPORT_DEF1(SField, Color3fx )
276 OSG_FIELD_DLLEXPORT_DEF1(SField, Color4f )
277 OSG_FIELD_DLLEXPORT_DEF1(SField, Color4fx )
278 OSG_FIELD_DLLEXPORT_DEF1(SField, Color3ub )
279 OSG_FIELD_DLLEXPORT_DEF1(SField, Color4ub )
280 OSG_FIELD_DLLEXPORT_DEF1(SField, std::string )
281 OSG_FIELD_DLLEXPORT_DEF2(SField, Time, 1)
282 OSG_FIELD_DLLEXPORT_DEF1(SField, BoxVolume )
283 OSG_FIELD_DLLEXPORT_DEF2(SField, BitVector, 1)
284 OSG_FIELD_DLLEXPORT_DEF2(SField, GLenum, 1)
285 OSG_FIELD_DLLEXPORT_DEF1(SField, Plane )
287 OSG_FIELD_DLLEXPORT_DEF1(MField, Color3f )
288 OSG_FIELD_DLLEXPORT_DEF1(MField, Color3fx )
289 OSG_FIELD_DLLEXPORT_DEF1(MField, Color4f )
290 OSG_FIELD_DLLEXPORT_DEF1(MField, Color4fx )
291 OSG_FIELD_DLLEXPORT_DEF1(MField, Color3ub )
292 OSG_FIELD_DLLEXPORT_DEF1(MField, Color4ub )
293 OSG_FIELD_DLLEXPORT_DEF1(MField, std::string )
294 OSG_FIELD_DLLEXPORT_DEF2(MField, Time, 1)
295 OSG_FIELD_DLLEXPORT_DEF1(MField, BoxVolume )
296 OSG_FIELD_DLLEXPORT_DEF2(MField, BitVector, 1)
297 OSG_FIELD_DLLEXPORT_DEF2(MField, GLenum, 1)
298 OSG_FIELD_DLLEXPORT_DEF1(MField, Plane )
300 OSG_FIELD_DLLEXPORT_DEF1(SField, Matrix )
301 OSG_FIELD_DLLEXPORT_DEF1(SField, Matrix4d )
302 OSG_FIELD_DLLEXPORT_DEF1(SField, Matrix4fx )
303 OSG_FIELD_DLLEXPORT_DEF1(SField, Quaternion )
304 OSG_FIELD_DLLEXPORT_DEF1(SField, Quaternionfx )
306 OSG_FIELD_DLLEXPORT_DEF1(MField, Matrix )
307 OSG_FIELD_DLLEXPORT_DEF1(MField, Matrix4d )
308 OSG_FIELD_DLLEXPORT_DEF1(MField, Matrix4fx )
309 OSG_FIELD_DLLEXPORT_DEF1(MField, Quaternion )
310 OSG_FIELD_DLLEXPORT_DEF1(MField, Quaternionfx )
312 OSG_END_NAMESPACE