Coin Logo http://www.sim.no
http://www.coin3d.org

SbTypeInfo.h
1 #ifndef COIN_SBTYPEINFO_H
2 #define COIN_SBTYPEINFO_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 // SbTypeInfo<> is a Coin type information library.
28 
62 #include <Inventor/system/inttypes.h>
63 
64 // *************************************************************************
65 // Predeclarations
66 
67 // Sb-classes
68 class SbVec2b;
69 class SbVec2ub;
70 class SbVec2s;
71 class SbVec2us;
72 class SbVec2i32;
73 class SbVec2ui32;
74 class SbVec2f;
75 class SbVec2d;
76 class SbVec3b;
77 class SbVec3ub;
78 class SbVec3s;
79 class SbVec3us;
80 class SbVec3i32;
81 class SbVec3ui32;
82 class SbVec3f;
83 class SbVec3d;
84 class SbVec4b;
85 class SbVec4ub;
86 class SbVec4s;
87 class SbVec4us;
88 class SbVec4i32;
89 class SbVec4ui32;
90 class SbVec4f;
91 class SbVec4d;
92 
93 class SbBox2s;
94 class SbBox2i32;
95 class SbBox2f;
96 class SbBox2d;
97 class SbBox3s;
98 class SbBox3i32;
99 class SbBox3f;
100 class SbBox3d;
101 
102 class SbLine;
103 class SbDPLine;
104 class SbPlane;
105 class SbDPPlane;
106 class SbMatrix;
107 class SbDPMatrix;
108 class SbRotation;
109 class SbDPRotation;
110 
111 class SbTime;
112 class SbName;
113 class SbColor;
114 class SbColor4f;
115 class SbString;
116 
117 // Field classes
118 class SoSFBitMask;
119 class SoSFBool;
120 class SoSFBox2s;
121 class SoSFBox2i32;
122 class SoSFBox2f;
123 class SoSFBox2d;
124 class SoSFBox3s;
125 class SoSFBox3i32;
126 class SoSFBox3f;
127 class SoSFBox3d;
128 class SoSFColor;
129 class SoSFEngine;
130 class SoSFEnum;
131 class SoSFImage3;
132 class SoSFImage;
133 class SoSFMatrix;
134 class SoSFName;
135 class SoSFNode;
136 class SoSFPath;
137 class SoSFPlane;
138 class SoSFRotation;
139 class SoSFString;
140 class SoSFTime;
141 class SoSFTrigger;
142 
143 class SoSFShort;
144 class SoSFUShort;
145 class SoSFInt32;
146 class SoSFUInt32;
147 class SoSFLong;
148 class SoSFULong;
149 class SoSFFloat;
150 class SoSFDouble;
151 
152 class SoSFVec2b;
153 class SoSFVec2s;
154 class SoSFVec2i32;
155 class SoSFVec2f;
156 class SoSFVec2d;
157 class SoSFVec3b;
158 class SoSFVec3s;
159 class SoSFVec3i32;
160 class SoSFVec3f;
161 class SoSFVec3d;
162 class SoSFVec4b;
163 class SoSFVec4ub;
164 class SoSFVec4s;
165 class SoSFVec4us;
166 class SoSFVec4i32;
167 class SoSFVec4ui32;
168 class SoSFVec4f;
169 class SoSFVec4d;
170 
171 class SoMFBitMask;
172 class SoMFBool;
173 class SoMFColor;
174 class SoMFDouble;
175 class SoMFEngine;
176 class SoMFEnum;
177 class SoMFFloat;
178 class SoMFInt32;
179 class SoMFLong;
180 class SoMFMatrix;
181 class SoMFName;
182 class SoMFNode;
183 class SoMFPath;
184 class SoMFPlane;
185 class SoMFRotation;
186 class SoMFShort;
187 class SoMFString;
188 class SoMFTime;
189 class SoMFUInt32;
190 class SoMFULong;
191 class SoMFUShort;
192 class SoMFVec2b;
193 class SoMFVec2s;
194 class SoMFVec2i32;
195 class SoMFVec2f;
196 class SoMFVec2d;
197 class SoMFVec3b;
198 class SoMFVec3s;
199 class SoMFVec3i32;
200 class SoMFVec3f;
201 class SoMFVec3d;
202 class SoMFVec4b;
203 class SoMFVec4ub;
204 class SoMFVec4s;
205 class SoMFVec4us;
206 class SoMFVec4i32;
207 class SoMFVec4ui32;
208 class SoMFVec4f;
209 class SoMFVec4d;
210 
211 // *************************************************************************
212 
213 template <typename T>
214 struct SbTypeInfo {
215  typedef T Type;
216  typedef const T & ParamType;
217 }; // fallback
218 
219 template <>
220 struct SbTypeInfo<float> {
221  typedef float Type;
222  typedef Type ParamType;
223 
224  typedef SbVec2f Vec2Type;
225  typedef SbVec3f Vec3Type;
226  typedef SbVec4f Vec4Type;
227  typedef SbBox2f Box2Type;
228  typedef SbBox3f Box3Type;
229 
230  typedef SoSFFloat SFieldType;
231  typedef SoMFFloat MFieldType;
232 
233  typedef SbPlane PlaneType;
234  typedef SbLine LineType;
235  typedef SbMatrix MatrixType;
236  typedef SbRotation RotationType;
237 };
238 
239 template <>
240 struct SbTypeInfo<double> {
241  typedef double Type;
242  typedef Type ParamType;
243 
244  typedef SbVec2d Vec2Type;
245  typedef SbVec3d Vec3Type;
246  typedef SbVec4d Vec4Type;
247  typedef SbBox2d Box2Type;
248  typedef SbBox3d Box3Type;
249 
250  typedef SoSFDouble SFieldType;
251  typedef SoMFDouble MFieldType;
252 
253  typedef SbDPPlane PlaneType;
254  typedef SbDPLine LineType;
255  typedef SbDPMatrix MatrixType;
256  typedef SbDPRotation RotationType;
257 };
258 
259 template <>
260 struct SbTypeInfo<int8_t> {
261  typedef int8_t Type;
262  typedef Type ParamType;
263 
264  typedef SbVec2b Vec2Type;
265  typedef SbVec3b Vec3Type;
266  typedef SbVec4b Vec4Type;
267 };
268 
269 template <>
270 struct SbTypeInfo<uint8_t> {
271  typedef uint8_t Type;
272  typedef Type ParamType;
273 
274  typedef SbVec2ub Vec2Type;
275  typedef SbVec3ub Vec3Type;
276  typedef SbVec4ub Vec4Type;
277 };
278 
279 template <>
280 struct SbTypeInfo<short> {
281  typedef short Type;
282  typedef Type ParamType;
283 
284  typedef SbVec2s Vec2Type;
285  typedef SbVec3s Vec3Type;
286  typedef SbVec4s Vec4Type;
287  typedef SbBox2s Box2Type;
288  typedef SbBox3s Box3Type;
289 
290  typedef SoSFShort SFieldType;
291  typedef SoMFShort MFieldType;
292 };
293 
294 template <>
295 struct SbTypeInfo<unsigned short> {
296  typedef unsigned short Type;
297  typedef Type ParamType;
298 
299  typedef SbVec2us Vec2Type;
300  typedef SbVec3us Vec3Type;
301  typedef SbVec4us Vec4Type;
302 
303  typedef SoSFUShort SFieldType;
304  typedef SoMFUShort MFieldType;
305 };
306 
307 template <>
308 struct SbTypeInfo<int32_t> {
309  typedef int32_t Type;
310  typedef Type ParamType;
311 
312  typedef SbVec2i32 Vec2Type;
313  typedef SbVec3i32 Vec3Type;
314  typedef SbVec4i32 Vec4Type;
315  typedef SbBox2i32 Box2Type;
316  typedef SbBox3i32 Box3Type;
317 
318  typedef SoSFInt32 SFieldType;
319  typedef SoMFInt32 MFieldType;
320 };
321 
322 template <>
323 struct SbTypeInfo<uint32_t> {
324  typedef uint32_t Type;
325  typedef Type ParamType;
326 
327  typedef SbVec2ui32 Vec2Type;
328  typedef SbVec3ui32 Vec3Type;
329  typedef SbVec4ui32 Vec4Type;
330 
331  typedef SoSFUInt32 SFieldType;
332  typedef SoMFUInt32 MFieldType;
333 };
334 
335 
336 template <>
337 struct SbTypeInfo<SbVec2f> {
338  typedef SbVec2f Type;
339  typedef const Type & ParamType;
340 
341  typedef float PrimitiveType;
342  enum { Dimensions = 2 };
343 
344  typedef SbBox2f BoxType;
345 
346  typedef SoSFVec2f SFieldType;
347  typedef SoMFVec2f MFieldType;
348 };
349 
350 template <>
351 struct SbTypeInfo<SbVec2d> {
352  typedef SbVec2d Type;
353  typedef const Type & ParamType;
354 
355  typedef double PrimitiveType;
356  enum { Dimensions = 2 };
357 
358  typedef SbBox2d BoxType;
359 
360  typedef SoSFVec2d SFieldType;
361  typedef SoMFVec2d MFieldType;
362 };
363 
364 template <>
365 struct SbTypeInfo<SbVec2b> {
366  typedef SbVec2b Type;
367  typedef Type ParamType;
368 
369  typedef int8_t PrimitiveType;
370  enum { Dimensions = 2 };
371 
372  typedef SoSFVec2b SFieldType;
373  typedef SoMFVec2b MFieldType;
374 };
375 
376 template <>
377 struct SbTypeInfo<SbVec2ub> {
378  typedef SbVec2ub Type;
379  typedef Type ParamType;
380 
381  typedef uint8_t PrimitiveType;
382  enum { Dimensions = 2 };
383 };
384 
385 template <>
386 struct SbTypeInfo<SbVec2s> {
387  typedef SbVec2s Type;
388  typedef Type ParamType;
389 
390  typedef short PrimitiveType;
391  enum { Dimensions = 2 };
392 
393  typedef SbBox2s BoxType;
394 
395  typedef SoSFVec2s SFieldType;
396  typedef SoMFVec2s MFieldType;
397 };
398 
399 template <>
400 struct SbTypeInfo<SbVec2us> {
401  typedef SbVec2us Type;
402  typedef Type ParamType;
403 
404  typedef unsigned short PrimitiveType;
405  enum { Dimensions = 2 };
406 };
407 
408 template <>
409 struct SbTypeInfo<SbVec2i32> {
410  typedef SbVec2i32 Type;
411  typedef const Type & ParamType;
412 
413  typedef int32_t PrimitiveType;
414  enum { Dimensions = 2 };
415 
416  typedef SbBox2i32 BoxType;
417 
418  typedef SoSFVec2i32 SFieldType;
419  typedef SoMFVec2i32 MFieldType;
420 };
421 
422 template <>
423 struct SbTypeInfo<SbVec2ui32> {
424  typedef SbVec2ui32 Type;
425  typedef const Type & ParamType;
426 
427  typedef uint32_t PrimitiveType;
428  enum { Dimensions = 2 };
429 };
430 
431 template <>
432 struct SbTypeInfo<SbVec3f> {
433  typedef SbVec3f Type;
434  typedef const Type & ParamType;
435 
436  typedef float PrimitiveType;
437  enum { Dimensions = 3 };
438 
439  typedef SbBox3f BoxType;
440 
441  typedef SoSFVec3f SFieldType;
442  typedef SoMFVec3f MFieldType;
443 };
444 
445 template <>
446 struct SbTypeInfo<SbVec3d> {
447  typedef SbVec3d Type;
448  typedef const Type & ParamType;
449 
450  typedef double PrimitiveType;
451  enum { Dimensions = 3 };
452 
453  typedef SbBox3d BoxType;
454 
455  typedef SoSFVec3d SFieldType;
456  typedef SoMFVec3d MFieldType;
457 };
458 
459 template <>
460 struct SbTypeInfo<SbVec3b> {
461  typedef SbVec3b Type;
462  typedef Type ParamType;
463 
464  typedef int8_t PrimitiveType;
465  enum { Dimensions = 3 };
466 
467  typedef SoSFVec3b SFieldType;
468  typedef SoMFVec3b MFieldType;
469 };
470 
471 template <>
472 struct SbTypeInfo<SbVec3ub> {
473  typedef SbVec3ub Type;
474  typedef Type ParamType;
475 
476  typedef uint8_t PrimitiveType;
477  enum { Dimensions = 3 };
478 };
479 
480 template <>
481 struct SbTypeInfo<SbVec3s> {
482  typedef SbVec3s Type;
483  typedef const Type & ParamType;
484 
485  typedef short PrimitiveType;
486  enum { Dimensions = 3 };
487 
488  typedef SbBox3s BoxType;
489 
490  typedef SoSFVec3s SFieldType;
491  typedef SoMFVec3s MFieldType;
492 };
493 
494 template <>
495 struct SbTypeInfo<SbVec3us> {
496  typedef SbVec3us Type;
497  typedef const Type & ParamType;
498 
499  typedef unsigned short PrimitiveType;
500  enum { Dimensions = 3 };
501 };
502 
503 template <>
504 struct SbTypeInfo<SbVec3i32> {
505  typedef SbVec3i32 Type;
506  typedef const Type & ParamType;
507 
508  typedef int32_t PrimitiveType;
509  enum { Dimensions = 3 };
510 
511  typedef SbBox3i32 BoxType;
512 
513  typedef SoSFVec3i32 SFieldType;
514  typedef SoMFVec3i32 MFieldType;
515 };
516 
517 template <>
518 struct SbTypeInfo<SbVec3ui32> {
519  typedef SbVec3ui32 Type;
520  typedef const Type & ParamType;
521 
522  typedef uint32_t PrimitiveType;
523  enum { Dimensions = 3 };
524 };
525 
526 template <>
527 struct SbTypeInfo<SbVec4f> {
528  typedef SbVec4f Type;
529  typedef const Type & ParamType;
530 
531  typedef float PrimitiveType;
532  enum { Dimensions = 4 };
533 
534  typedef SoSFVec4f SFieldType;
535  typedef SoMFVec4f MFieldType;
536 };
537 
538 template <>
539 struct SbTypeInfo<SbVec4d> {
540  typedef SbVec4d Type;
541  typedef const Type & ParamType;
542 
543  typedef double PrimitiveType;
544  enum { Dimensions = 4 };
545 
546  typedef SoSFVec4d SFieldType;
547  typedef SoMFVec4d MFieldType;
548 };
549 
550 template <>
551 struct SbTypeInfo<SbVec4b> {
552  typedef SbVec4b Type;
553  typedef Type ParamType;
554 
555  typedef int8_t PrimitiveType;
556  enum { Dimensions = 4 };
557 
558  typedef SoSFVec4b SFieldType;
559  typedef SoMFVec4b MFieldType;
560 };
561 
562 template <>
563 struct SbTypeInfo<SbVec4ub> {
564  typedef SbVec4ub Type;
565  typedef Type ParamType;
566 
567  typedef uint8_t PrimitiveType;
568  enum { Dimensions = 4 };
569 
570  typedef SoSFVec4ub SFieldType;
571  typedef SoMFVec4ub MFieldType;
572 };
573 
574 template <>
575 struct SbTypeInfo<SbVec4s> {
576  typedef SbVec4s Type;
577  typedef const Type & ParamType;
578 
579  typedef short PrimitiveType;
580  enum { Dimensions = 4 };
581 
582  typedef SoSFVec4s SFieldType;
583  typedef SoMFVec4s MFieldType;
584 };
585 
586 template <>
587 struct SbTypeInfo<SbVec4us> {
588  typedef SbVec4us Type;
589  typedef const Type & ParamType;
590 
591  typedef unsigned short PrimitiveType;
592  enum { Dimensions = 4 };
593 
594  typedef SoSFVec4us SFieldType;
595  typedef SoMFVec4us MFieldType;
596 };
597 
598 template <>
599 struct SbTypeInfo<SbVec4i32> {
600  typedef SbVec4i32 Type;
601  typedef const Type & ParamType;
602 
603  typedef int32_t PrimitiveType;
604  enum { Dimensions = 4 };
605 
606  typedef SoSFVec4i32 SFieldType;
607  typedef SoMFVec4i32 MFieldType;
608 };
609 
610 template <>
611 struct SbTypeInfo<SbVec4ui32> {
612  typedef SbVec4ui32 Type;
613  typedef const Type & ParamType;
614 
615  typedef uint32_t PrimitiveType;
616  enum { Dimensions = 4 };
617 
618  typedef SoSFVec4ui32 SFieldType;
619  typedef SoMFVec4ui32 MFieldType;
620 };
621 
622 template <>
623 struct SbTypeInfo<SbBox2f> {
624  typedef SbBox2f Type;
625  typedef const Type & ParamType;
626 
627  typedef float PrimitiveType;
628  enum { Dimensions = 2 };
629 
630  typedef SbVec2f VecType;
631 
632  typedef SoSFBox2f SFieldType;
633 };
634 
635 template <>
636 struct SbTypeInfo<SbBox2d> {
637  typedef SbBox2d Type;
638  typedef const Type & ParamType;
639 
640  typedef double PrimitiveType;
641  enum { Dimensions = 2 };
642 
643  typedef SbVec2d VecType;
644 
645  typedef SoSFBox2d SFieldType;
646 };
647 
648 template <>
649 struct SbTypeInfo<SbBox2s> {
650  typedef SbBox2s Type;
651  typedef const Type & ParamType;
652 
653  typedef short PrimitiveType;
654  enum { Dimensions = 2 };
655 
656  typedef SbVec2s VecType;
657 
658  typedef SoSFBox2s SFieldType;
659 };
660 
661 template <>
662 struct SbTypeInfo<SbBox2i32> {
663  typedef SbBox2i32 Type;
664  typedef const Type & ParamType;
665 
666  typedef int32_t PrimitiveType;
667  enum { Dimensions = 2 };
668 
669  typedef SbVec2i32 VecType;
670 
671  typedef SoSFBox2i32 SFieldType;
672 };
673 
674 template <>
675 struct SbTypeInfo<SbBox3f> {
676  typedef SbBox3f Type;
677  typedef const Type & ParamType;
678 
679  typedef float PrimitiveType;
680  enum { Dimensions = 3 };
681 
682  typedef SbVec3f VecType;
683 
684  typedef SoSFBox3f SFieldType;
685 };
686 
687 template <>
688 struct SbTypeInfo<SbBox3d> {
689  typedef SbBox3d Type;
690  typedef const Type & ParamType;
691 
692  typedef double PrimitiveType;
693  enum { Dimensions = 3 };
694 
695  typedef SbVec3d VecType;
696 
697  typedef SoSFBox3d SFieldType;
698 };
699 
700 template <>
701 struct SbTypeInfo<SbBox3s> {
702  typedef SbBox3s Type;
703  typedef const Type & ParamType;
704 
705  typedef short PrimitiveType;
706  enum { Dimensions = 3 };
707 
708  typedef SbVec3s VecType;
709 
710  typedef SoSFBox3s SFieldType;
711 };
712 
713 template <>
714 struct SbTypeInfo<SbBox3i32> {
715  typedef SbBox3i32 Type;
716  typedef const Type & ParamType;
717 
718  typedef int32_t PrimitiveType;
719  enum { Dimensions = 3 };
720 
721  typedef SbVec3i32 VecType;
722 
723  typedef SoSFBox3i32 SFieldType;
724 };
725 
726 template <>
727 struct SbTypeInfo<SbPlane> {
728  typedef SbPlane Type;
729  typedef const Type & ParamType;
730 
731  typedef float PrimitiveType;
732  enum { Dimensions = 3 };
733 
734  typedef SoSFPlane SFieldType;
735  typedef SoMFPlane MFieldType;
736 };
737 
738 template <>
739 struct SbTypeInfo<SbDPPlane> {
740  typedef SbDPPlane Type;
741  typedef const Type & ParamType;
742 
743  typedef double PrimitiveType;
744  enum { Dimensions = 3 };
745 };
746 
747 template <>
748 struct SbTypeInfo<SbLine> {
749  typedef SbLine Type;
750  typedef const Type & ParamType;
751 
752  typedef float PrimitiveType;
753  enum { Dimensions = 3 };
754 };
755 
756 template <>
757 struct SbTypeInfo<SbDPLine> {
758  typedef SbDPLine Type;
759  typedef const Type & ParamType;
760 
761  typedef double PrimitiveType;
762  enum { Dimensions = 3 };
763 };
764 
765 template <>
766 struct SbTypeInfo<SbRotation> {
767  typedef SbRotation Type;
768  typedef const Type & ParamType;
769 
770  typedef float PrimitiveType;
771 
772  typedef SoSFRotation SFieldType;
773  typedef SoMFRotation MFieldType;
774 };
775 
776 template <>
777 struct SbTypeInfo<SbDPRotation> {
778  typedef SbDPRotation Type;
779  typedef const Type & ParamType;
780 
781  typedef double PrimitiveType;
782 };
783 
784 template <>
785 struct SbTypeInfo<SbMatrix> {
786  typedef SbMatrix Type;
787  typedef const Type & ParamType;
788 
789  typedef float PrimitiveType;
790 
791  typedef SoSFMatrix SFieldType;
792  typedef SoMFMatrix MFieldType;
793 };
794 
795 template <>
796 struct SbTypeInfo<SbDPMatrix> {
797  typedef SbDPMatrix Type;
798  typedef const Type & ParamType;
799 
800  typedef double PrimitiveType;
801 };
802 
803 // *************************************************************************
804 
805 #endif // !COIN_SBTYPEINFO_H

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Thu Aug 15 2013 for Coin by Doxygen. 1.8.4