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

SbTypeInfo.h

00001 #ifndef COIN_SBTYPEINFO_H
00002 #define COIN_SBTYPEINFO_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2007 by Systems in Motion.  All rights reserved.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Systems in Motion about acquiring
00018  *  a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 // SbTypeInfo<> is a Coin type information library.
00028 
00062 #include <Inventor/system/inttypes.h>
00063 
00064 // *************************************************************************
00065 // Predeclarations
00066 
00067 // Sb-classes
00068 class SbVec2b;
00069 class SbVec2ub;
00070 class SbVec2s;
00071 class SbVec2us;
00072 class SbVec2i32;
00073 class SbVec2ui32;
00074 class SbVec2f;
00075 class SbVec2d;
00076 class SbVec3b;
00077 class SbVec3ub;
00078 class SbVec3s;
00079 class SbVec3us;
00080 class SbVec3i32;
00081 class SbVec3ui32;
00082 class SbVec3f;
00083 class SbVec3d;
00084 class SbVec4b;
00085 class SbVec4ub;
00086 class SbVec4s;
00087 class SbVec4us;
00088 class SbVec4i32;
00089 class SbVec4ui32;
00090 class SbVec4f;
00091 class SbVec4d;
00092 
00093 class SbBox2s;
00094 class SbBox2i32;
00095 class SbBox2f;
00096 class SbBox2d;
00097 class SbBox3s;
00098 class SbBox3i32;
00099 class SbBox3f;
00100 class SbBox3d;
00101 
00102 class SbLine;
00103 class SbDPLine;
00104 class SbPlane;
00105 class SbDPPlane;
00106 class SbMatrix;
00107 class SbDPMatrix;
00108 class SbRotation;
00109 class SbDPRotation;
00110 
00111 class SbTime;
00112 class SbName;
00113 class SbColor;
00114 class SbColor4f;
00115 class SbString;
00116 
00117 // Field classes
00118 class SoSFBitMask;
00119 class SoSFBool;
00120 class SoSFBox2s;
00121 class SoSFBox2i32;
00122 class SoSFBox2f;
00123 class SoSFBox2d;
00124 class SoSFBox3s;
00125 class SoSFBox3i32;
00126 class SoSFBox3f;
00127 class SoSFBox3d;
00128 class SoSFColor;
00129 class SoSFEngine;
00130 class SoSFEnum;
00131 class SoSFImage3;
00132 class SoSFImage;
00133 class SoSFMatrix;
00134 class SoSFName;
00135 class SoSFNode;
00136 class SoSFPath;
00137 class SoSFPlane;
00138 class SoSFRotation;
00139 class SoSFString;
00140 class SoSFTime;
00141 class SoSFTrigger;
00142 
00143 class SoSFShort;
00144 class SoSFUShort;
00145 class SoSFInt32;
00146 class SoSFUInt32;
00147 class SoSFLong;
00148 class SoSFULong;
00149 class SoSFFloat;
00150 class SoSFDouble;
00151 
00152 class SoSFVec2b;
00153 class SoSFVec2s;
00154 class SoSFVec2i32;
00155 class SoSFVec2f;
00156 class SoSFVec2d;
00157 class SoSFVec3b;
00158 class SoSFVec3s;
00159 class SoSFVec3i32;
00160 class SoSFVec3f;
00161 class SoSFVec3d;
00162 class SoSFVec4b;
00163 class SoSFVec4ub;
00164 class SoSFVec4s;
00165 class SoSFVec4us;
00166 class SoSFVec4i32;
00167 class SoSFVec4ui32;
00168 class SoSFVec4f;
00169 class SoSFVec4d;
00170 
00171 class SoMFBitMask;
00172 class SoMFBool;
00173 class SoMFColor;
00174 class SoMFDouble;
00175 class SoMFEngine;
00176 class SoMFEnum;
00177 class SoMFFloat;
00178 class SoMFInt32;
00179 class SoMFLong;
00180 class SoMFMatrix;
00181 class SoMFName;
00182 class SoMFNode;
00183 class SoMFPath;
00184 class SoMFPlane;
00185 class SoMFRotation;
00186 class SoMFShort;
00187 class SoMFString;
00188 class SoMFTime;
00189 class SoMFUInt32;
00190 class SoMFULong;
00191 class SoMFUShort;
00192 class SoMFVec2b;
00193 class SoMFVec2s;
00194 class SoMFVec2i32;
00195 class SoMFVec2f;
00196 class SoMFVec2d;
00197 class SoMFVec3b;
00198 class SoMFVec3s;
00199 class SoMFVec3i32;
00200 class SoMFVec3f;
00201 class SoMFVec3d;
00202 class SoMFVec4b;
00203 class SoMFVec4ub;
00204 class SoMFVec4s;
00205 class SoMFVec4us;
00206 class SoMFVec4i32;
00207 class SoMFVec4ui32;
00208 class SoMFVec4f;
00209 class SoMFVec4d;
00210 
00211 // *************************************************************************
00212 
00213 template <typename T>
00214 struct SbTypeInfo {
00215   typedef T Type;
00216   typedef const T & ParamType;
00217 }; // fallback
00218 
00219 template <>
00220 struct SbTypeInfo<float> {
00221   typedef float Type;
00222   typedef Type ParamType;
00223 
00224   typedef SbVec2f Vec2Type;
00225   typedef SbVec3f Vec3Type;
00226   typedef SbVec4f Vec4Type;
00227   typedef SbBox2f Box2Type;
00228   typedef SbBox3f Box3Type;
00229 
00230   typedef SoSFFloat SFieldType;
00231   typedef SoMFFloat MFieldType;
00232 
00233   typedef SbPlane PlaneType;
00234   typedef SbLine LineType;
00235   typedef SbMatrix MatrixType;
00236   typedef SbRotation RotationType;
00237 };
00238 
00239 template <>
00240 struct SbTypeInfo<double> {
00241   typedef double Type;
00242   typedef Type ParamType;
00243 
00244   typedef SbVec2d Vec2Type;
00245   typedef SbVec3d Vec3Type;
00246   typedef SbVec4d Vec4Type;
00247   typedef SbBox2d Box2Type;
00248   typedef SbBox3d Box3Type;
00249 
00250   typedef SoSFDouble SFieldType;
00251   typedef SoMFDouble MFieldType;
00252 
00253   typedef SbDPPlane PlaneType;
00254   typedef SbDPLine LineType;
00255   typedef SbDPMatrix MatrixType;
00256   typedef SbDPRotation RotationType;
00257 };
00258 
00259 template <>
00260 struct SbTypeInfo<int8_t> {
00261   typedef int8_t Type;
00262   typedef Type ParamType;
00263 
00264   typedef SbVec2b Vec2Type;
00265   typedef SbVec3b Vec3Type;
00266   typedef SbVec4b Vec4Type;
00267 };
00268 
00269 template <>
00270 struct SbTypeInfo<uint8_t> {
00271   typedef uint8_t Type;
00272   typedef Type ParamType;
00273 
00274   typedef SbVec2ub Vec2Type;
00275   typedef SbVec3ub Vec3Type;
00276   typedef SbVec4ub Vec4Type;
00277 };
00278 
00279 template <>
00280 struct SbTypeInfo<short> {
00281   typedef short Type;
00282   typedef Type ParamType;
00283 
00284   typedef SbVec2s Vec2Type;
00285   typedef SbVec3s Vec3Type;
00286   typedef SbVec4s Vec4Type;
00287   typedef SbBox2s Box2Type;
00288   typedef SbBox3s Box3Type;
00289 
00290   typedef SoSFShort SFieldType;
00291   typedef SoMFShort MFieldType;
00292 };
00293 
00294 template <>
00295 struct SbTypeInfo<unsigned short> {
00296   typedef unsigned short Type;
00297   typedef Type ParamType;
00298 
00299   typedef SbVec2us Vec2Type;
00300   typedef SbVec3us Vec3Type;
00301   typedef SbVec4us Vec4Type;
00302 
00303   typedef SoSFUShort SFieldType;
00304   typedef SoMFUShort MFieldType;
00305 };
00306 
00307 template <>
00308 struct SbTypeInfo<int32_t> {
00309   typedef int32_t Type;
00310   typedef Type ParamType;
00311 
00312   typedef SbVec2i32 Vec2Type;
00313   typedef SbVec3i32 Vec3Type;
00314   typedef SbVec4i32 Vec4Type;
00315   typedef SbBox2i32 Box2Type;
00316   typedef SbBox3i32 Box3Type;
00317 
00318   typedef SoSFInt32 SFieldType;
00319   typedef SoMFInt32 MFieldType;
00320 };
00321 
00322 template <>
00323 struct SbTypeInfo<uint32_t> {
00324   typedef uint32_t Type;
00325   typedef Type ParamType;
00326 
00327   typedef SbVec2ui32 Vec2Type;
00328   typedef SbVec3ui32 Vec3Type;
00329   typedef SbVec4ui32 Vec4Type;
00330 
00331   typedef SoSFUInt32 SFieldType;
00332   typedef SoMFUInt32 MFieldType;
00333 };
00334 
00335 
00336 template <>
00337 struct SbTypeInfo<SbVec2f> {
00338   typedef SbVec2f Type;
00339   typedef const Type & ParamType;
00340 
00341   typedef float PrimitiveType;
00342   enum { Dimensions = 2 };
00343 
00344   typedef SbBox2f BoxType;
00345 
00346   typedef SoSFVec2f SFieldType;
00347   typedef SoMFVec2f MFieldType;
00348 };
00349 
00350 template <>
00351 struct SbTypeInfo<SbVec2d> {
00352   typedef SbVec2d Type;
00353   typedef const Type & ParamType;
00354 
00355   typedef double PrimitiveType;
00356   enum { Dimensions = 2 };
00357 
00358   typedef SbBox2d BoxType;
00359 
00360   typedef SoSFVec2d SFieldType;
00361   typedef SoMFVec2d MFieldType;
00362 };
00363 
00364 template <>
00365 struct SbTypeInfo<SbVec2b> {
00366   typedef SbVec2b Type;
00367   typedef Type ParamType;
00368 
00369   typedef int8_t PrimitiveType;
00370   enum { Dimensions = 2 };
00371 
00372   typedef SoSFVec2b SFieldType;
00373   typedef SoMFVec2b MFieldType;
00374 };
00375 
00376 template <>
00377 struct SbTypeInfo<SbVec2ub> {
00378   typedef SbVec2ub Type;
00379   typedef Type ParamType;
00380 
00381   typedef uint8_t PrimitiveType;
00382   enum { Dimensions = 2 };
00383 };
00384 
00385 template <>
00386 struct SbTypeInfo<SbVec2s> {
00387   typedef SbVec2s Type;
00388   typedef Type ParamType;
00389 
00390   typedef short PrimitiveType;
00391   enum { Dimensions = 2 };
00392 
00393   typedef SbBox2s BoxType;
00394 
00395   typedef SoSFVec2s SFieldType;
00396   typedef SoMFVec2s MFieldType;
00397 };
00398 
00399 template <>
00400 struct SbTypeInfo<SbVec2us> {
00401   typedef SbVec2us Type;
00402   typedef Type ParamType;
00403 
00404   typedef unsigned short PrimitiveType;
00405   enum { Dimensions = 2 };
00406 };
00407 
00408 template <>
00409 struct SbTypeInfo<SbVec2i32> {
00410   typedef SbVec2i32 Type;
00411   typedef const Type & ParamType;
00412 
00413   typedef int32_t PrimitiveType;
00414   enum { Dimensions = 2 };
00415 
00416   typedef SbBox2i32 BoxType;
00417 
00418   typedef SoSFVec2i32 SFieldType;
00419   typedef SoMFVec2i32 MFieldType;
00420 };
00421 
00422 template <>
00423 struct SbTypeInfo<SbVec2ui32> {
00424   typedef SbVec2ui32 Type;
00425   typedef const Type & ParamType;
00426 
00427   typedef uint32_t PrimitiveType;
00428   enum { Dimensions = 2 };
00429 };
00430 
00431 template <>
00432 struct SbTypeInfo<SbVec3f> {
00433   typedef SbVec3f Type;
00434   typedef const Type & ParamType;
00435 
00436   typedef float PrimitiveType;
00437   enum { Dimensions = 3 };
00438 
00439   typedef SbBox3f BoxType;
00440 
00441   typedef SoSFVec3f SFieldType;
00442   typedef SoMFVec3f MFieldType;
00443 };
00444 
00445 template <>
00446 struct SbTypeInfo<SbVec3d> {
00447   typedef SbVec3d Type;
00448   typedef const Type & ParamType;
00449 
00450   typedef double PrimitiveType;
00451   enum { Dimensions = 3 };
00452 
00453   typedef SbBox3d BoxType;
00454 
00455   typedef SoSFVec3d SFieldType;
00456   typedef SoMFVec3d MFieldType;
00457 };
00458 
00459 template <>
00460 struct SbTypeInfo<SbVec3b> {
00461   typedef SbVec3b Type;
00462   typedef Type ParamType;
00463 
00464   typedef int8_t PrimitiveType;
00465   enum { Dimensions = 3 };
00466 
00467   typedef SoSFVec3b SFieldType;
00468   typedef SoMFVec3b MFieldType;
00469 };
00470 
00471 template <>
00472 struct SbTypeInfo<SbVec3ub> {
00473   typedef SbVec3ub Type;
00474   typedef Type ParamType;
00475 
00476   typedef uint8_t PrimitiveType;
00477   enum { Dimensions = 3 };
00478 };
00479 
00480 template <>
00481 struct SbTypeInfo<SbVec3s> {
00482   typedef SbVec3s Type;
00483   typedef const Type & ParamType;
00484 
00485   typedef short PrimitiveType;
00486   enum { Dimensions = 3 };
00487 
00488   typedef SbBox3s BoxType;
00489 
00490   typedef SoSFVec3s SFieldType;
00491   typedef SoMFVec3s MFieldType;
00492 };
00493 
00494 template <>
00495 struct SbTypeInfo<SbVec3us> {
00496   typedef SbVec3us Type;
00497   typedef const Type & ParamType;
00498 
00499   typedef unsigned short PrimitiveType;
00500   enum { Dimensions = 3 };
00501 };
00502 
00503 template <>
00504 struct SbTypeInfo<SbVec3i32> {
00505   typedef SbVec3i32 Type;
00506   typedef const Type & ParamType;
00507 
00508   typedef int32_t PrimitiveType;
00509   enum { Dimensions = 3 };
00510 
00511   typedef SbBox3i32 BoxType;
00512 
00513   typedef SoSFVec3i32 SFieldType;
00514   typedef SoMFVec3i32 MFieldType;
00515 };
00516 
00517 template <>
00518 struct SbTypeInfo<SbVec3ui32> {
00519   typedef SbVec3ui32 Type;
00520   typedef const Type & ParamType;
00521 
00522   typedef uint32_t PrimitiveType;
00523   enum { Dimensions = 3 };
00524 };
00525 
00526 template <>
00527 struct SbTypeInfo<SbVec4f> {
00528   typedef SbVec4f Type;
00529   typedef const Type & ParamType;
00530 
00531   typedef float PrimitiveType;
00532   enum { Dimensions = 4 };
00533 
00534   typedef SoSFVec4f SFieldType;
00535   typedef SoMFVec4f MFieldType;
00536 };
00537 
00538 template <>
00539 struct SbTypeInfo<SbVec4d> {
00540   typedef SbVec4d Type;
00541   typedef const Type & ParamType;
00542 
00543   typedef double PrimitiveType;
00544   enum { Dimensions = 4 };
00545 
00546   typedef SoSFVec4d SFieldType;
00547   typedef SoMFVec4d MFieldType;
00548 };
00549 
00550 template <>
00551 struct SbTypeInfo<SbVec4b> {
00552   typedef SbVec4b Type;
00553   typedef Type ParamType;
00554 
00555   typedef int8_t PrimitiveType;
00556   enum { Dimensions = 4 };
00557 
00558   typedef SoSFVec4b SFieldType;
00559   typedef SoMFVec4b MFieldType;
00560 };
00561 
00562 template <>
00563 struct SbTypeInfo<SbVec4ub> {
00564   typedef SbVec4ub Type;
00565   typedef Type ParamType;
00566 
00567   typedef uint8_t PrimitiveType;
00568   enum { Dimensions = 4 };
00569 
00570   typedef SoSFVec4ub SFieldType;
00571   typedef SoMFVec4ub MFieldType;
00572 };
00573 
00574 template <>
00575 struct SbTypeInfo<SbVec4s> {
00576   typedef SbVec4s Type;
00577   typedef const Type & ParamType;
00578 
00579   typedef short PrimitiveType;
00580   enum { Dimensions = 4 };
00581 
00582   typedef SoSFVec4s SFieldType;
00583   typedef SoMFVec4s MFieldType;
00584 };
00585 
00586 template <>
00587 struct SbTypeInfo<SbVec4us> {
00588   typedef SbVec4us Type;
00589   typedef const Type & ParamType;
00590 
00591   typedef unsigned short PrimitiveType;
00592   enum { Dimensions = 4 };
00593 
00594   typedef SoSFVec4us SFieldType;
00595   typedef SoMFVec4us MFieldType;
00596 };
00597 
00598 template <>
00599 struct SbTypeInfo<SbVec4i32> {
00600   typedef SbVec4i32 Type;
00601   typedef const Type & ParamType;
00602 
00603   typedef int32_t PrimitiveType;
00604   enum { Dimensions = 4 };
00605 
00606   typedef SoSFVec4i32 SFieldType;
00607   typedef SoMFVec4i32 MFieldType;
00608 };
00609 
00610 template <>
00611 struct SbTypeInfo<SbVec4ui32> {
00612   typedef SbVec4ui32 Type;
00613   typedef const Type & ParamType;
00614 
00615   typedef uint32_t PrimitiveType;
00616   enum { Dimensions = 4 };
00617 
00618   typedef SoSFVec4ui32 SFieldType;
00619   typedef SoMFVec4ui32 MFieldType;
00620 };
00621 
00622 template <>
00623 struct SbTypeInfo<SbBox2f> {
00624   typedef SbBox2f Type;
00625   typedef const Type & ParamType;
00626 
00627   typedef float PrimitiveType;
00628   enum { Dimensions = 2 };
00629 
00630   typedef SbVec2f VecType;
00631 
00632   typedef SoSFBox2f SFieldType;
00633 };
00634 
00635 template <>
00636 struct SbTypeInfo<SbBox2d> {
00637   typedef SbBox2d Type;
00638   typedef const Type & ParamType;
00639 
00640   typedef double PrimitiveType;
00641   enum { Dimensions = 2 };
00642 
00643   typedef SbVec2d VecType;
00644 
00645   typedef SoSFBox2d SFieldType;
00646 };
00647 
00648 template <>
00649 struct SbTypeInfo<SbBox2s> {
00650   typedef SbBox2s Type;
00651   typedef const Type & ParamType;
00652 
00653   typedef short PrimitiveType;
00654   enum { Dimensions = 2 };
00655 
00656   typedef SbVec2s VecType;
00657 
00658   typedef SoSFBox2s SFieldType;
00659 };
00660 
00661 template <>
00662 struct SbTypeInfo<SbBox2i32> {
00663   typedef SbBox2i32 Type;
00664   typedef const Type & ParamType;
00665 
00666   typedef int32_t PrimitiveType;
00667   enum { Dimensions = 2 };
00668 
00669   typedef SbVec2i32 VecType;
00670 
00671   typedef SoSFBox2i32 SFieldType;
00672 };
00673 
00674 template <>
00675 struct SbTypeInfo<SbBox3f> {
00676   typedef SbBox3f Type;
00677   typedef const Type & ParamType;
00678 
00679   typedef float PrimitiveType;
00680   enum { Dimensions = 3 };
00681 
00682   typedef SbVec3f VecType;
00683 
00684   typedef SoSFBox3f SFieldType;
00685 };
00686 
00687 template <>
00688 struct SbTypeInfo<SbBox3d> {
00689   typedef SbBox3d Type;
00690   typedef const Type & ParamType;
00691 
00692   typedef double PrimitiveType;
00693   enum { Dimensions = 3 };
00694 
00695   typedef SbVec3d VecType;
00696 
00697   typedef SoSFBox3d SFieldType;
00698 };
00699 
00700 template <>
00701 struct SbTypeInfo<SbBox3s> {
00702   typedef SbBox3s Type;
00703   typedef const Type & ParamType;
00704 
00705   typedef short PrimitiveType;
00706   enum { Dimensions = 3 };
00707 
00708   typedef SbVec3s VecType;
00709 
00710   typedef SoSFBox3s SFieldType;
00711 };
00712 
00713 template <>
00714 struct SbTypeInfo<SbBox3i32> {
00715   typedef SbBox3i32 Type;
00716   typedef const Type & ParamType;
00717 
00718   typedef int32_t PrimitiveType;
00719   enum { Dimensions = 3 };
00720 
00721   typedef SbVec3i32 VecType;
00722 
00723   typedef SoSFBox3i32 SFieldType;
00724 };
00725 
00726 template <>
00727 struct SbTypeInfo<SbPlane> {
00728   typedef SbPlane Type;
00729   typedef const Type & ParamType;
00730 
00731   typedef float PrimitiveType;
00732   enum { Dimensions = 3 };
00733 
00734   typedef SoSFPlane SFieldType;
00735   typedef SoMFPlane MFieldType;
00736 };
00737 
00738 template <>
00739 struct SbTypeInfo<SbDPPlane> {
00740   typedef SbDPPlane Type;
00741   typedef const Type & ParamType;
00742 
00743   typedef double PrimitiveType;
00744   enum { Dimensions = 3 };
00745 };
00746 
00747 template <>
00748 struct SbTypeInfo<SbLine> {
00749   typedef SbLine Type;
00750   typedef const Type & ParamType;
00751 
00752   typedef float PrimitiveType;
00753   enum { Dimensions = 3 };
00754 };
00755 
00756 template <>
00757 struct SbTypeInfo<SbDPLine> {
00758   typedef SbDPLine Type;
00759   typedef const Type & ParamType;
00760 
00761   typedef double PrimitiveType;
00762   enum { Dimensions = 3 };
00763 };
00764 
00765 template <>
00766 struct SbTypeInfo<SbRotation> {
00767   typedef SbRotation Type;
00768   typedef const Type & ParamType;
00769 
00770   typedef float PrimitiveType;
00771 
00772   typedef SoSFRotation SFieldType;
00773   typedef SoMFRotation MFieldType;
00774 };
00775 
00776 template <>
00777 struct SbTypeInfo<SbDPRotation> {
00778   typedef SbDPRotation Type;
00779   typedef const Type & ParamType;
00780 
00781   typedef double PrimitiveType;
00782 };
00783 
00784 template <>
00785 struct SbTypeInfo<SbMatrix> {
00786   typedef SbMatrix Type;
00787   typedef const Type & ParamType;
00788 
00789   typedef float PrimitiveType;
00790 
00791   typedef SoSFMatrix SFieldType;
00792   typedef SoMFMatrix MFieldType;
00793 };
00794 
00795 template <>
00796 struct SbTypeInfo<SbDPMatrix> {
00797   typedef SbDPMatrix Type;
00798   typedef const Type & ParamType;
00799 
00800   typedef double PrimitiveType;
00801 };
00802 
00803 // *************************************************************************
00804 
00805 #endif // !COIN_SBTYPEINFO_H

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

Generated on Mon Feb 28 2011 10:11:53 for Coin by Doxygen. 1.7.3