1 #ifndef COIN_SBTYPEINFO_H 2 #define COIN_SBTYPEINFO_H 3 4 /**************************************************************************\ 5 * Copyright (c) Kongsberg Oil & Gas Technologies AS 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: 11 * 12 * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * 15 * Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * Neither the name of the copyright holder nor the names of its 20 * contributors may be used to endorse or promote products derived from 21 * this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 \**************************************************************************/ 35 36 // SbTypeInfo<> is a Coin type information library. 37 38 /*! 39 \class SbTypeInfo<> Inventor/SbTypeInfo.h 40 \brief a type information library for Coin types and their relations. 41 42 SbTypeInfo<> makes it possible to write generic code using Coin types that 43 is able to adjust itself to the parameter types used. Usually you would 44 be able to do that quite easily if the Sb-classes had been template classes 45 of Type and Dimension arguments. This type library makes it possible to 46 work around that lack of genericity by looking up type relationships instead. 47 48 Certain inside types of SbTypeInfo<> are always defined. Others will only 49 be defined if the template argument type is of certain characteristics. 50 51 Type is the type the SbTypeInfo<>-specialization is for. It is always 52 defined. 53 54 ParamType is a type deemed to be efficient for function parameter transfer. 55 It is always defined. 56 57 If the type is a primitive type that has 58 59 \since Coin 2.5 60 */ 61 62 #ifndef DOXYGEN_SKIP_THIS 63 64 #include <Inventor/system/inttypes.h> 65 #include <Inventor/C/basic.h> 66 67 // ************************************************************************* 68 // Predeclarations 69 70 // Sb-classes 71 class SbVec2b; 72 class SbVec2ub; 73 class SbVec2s; 74 class SbVec2us; 75 class SbVec2i32; 76 class SbVec2ui32; 77 class SbVec2f; 78 class SbVec2d; 79 class SbVec3b; 80 class SbVec3ub; 81 class SbVec3s; 82 class SbVec3us; 83 class SbVec3i32; 84 class SbVec3ui32; 85 class SbVec3f; 86 class SbVec3d; 87 class SbVec4b; 88 class SbVec4ub; 89 class SbVec4s; 90 class SbVec4us; 91 class SbVec4i32; 92 class SbVec4ui32; 93 class SbVec4f; 94 class SbVec4d; 95 96 class SbBox2s; 97 class SbBox2i32; 98 class SbBox2f; 99 class SbBox2d; 100 class SbBox3s; 101 class SbBox3i32; 102 class SbBox3f; 103 class SbBox3d; 104 105 class SbLine; 106 class SbDPLine; 107 class SbPlane; 108 class SbDPPlane; 109 class SbMatrix; 110 class SbDPMatrix; 111 class SbRotation; 112 class SbDPRotation; 113 114 class SbTime; 115 class SbName; 116 class SbColor; 117 class SbColor4f; 118 class SbString; 119 120 // Field classes 121 class SoSFBitMask; 122 class SoSFBool; 123 class SoSFBox2s; 124 class SoSFBox2i32; 125 class SoSFBox2f; 126 class SoSFBox2d; 127 class SoSFBox3s; 128 class SoSFBox3i32; 129 class SoSFBox3f; 130 class SoSFBox3d; 131 class SoSFColor; 132 class SoSFColorRGBA; 133 class SoSFEngine; 134 class SoSFEnum; 135 class SoSFImage3; 136 class SoSFImage; 137 class SoSFMatrix; 138 class SoSFName; 139 class SoSFNode; 140 class SoSFPath; 141 class SoSFPlane; 142 class SoSFRotation; 143 class SoSFString; 144 class SoSFTime; 145 class SoSFTrigger; 146 147 class SoSFShort; 148 class SoSFUShort; 149 class SoSFInt32; 150 class SoSFUInt32; 151 class SoSFLong; 152 class SoSFULong; 153 class SoSFFloat; 154 class SoSFDouble; 155 156 class SoSFVec2b; 157 class SoSFVec2s; 158 class SoSFVec2i32; 159 class SoSFVec2f; 160 class SoSFVec2d; 161 class SoSFVec3b; 162 class SoSFVec3s; 163 class SoSFVec3i32; 164 class SoSFVec3f; 165 class SoSFVec3d; 166 class SoSFVec4b; 167 class SoSFVec4ub; 168 class SoSFVec4s; 169 class SoSFVec4us; 170 class SoSFVec4i32; 171 class SoSFVec4ui32; 172 class SoSFVec4f; 173 class SoSFVec4d; 174 175 class SoMFBitMask; 176 class SoMFBool; 177 class SoMFColor; 178 class SoMFColorRGBA; 179 class SoMFDouble; 180 class SoMFEngine; 181 class SoMFEnum; 182 class SoMFFloat; 183 class SoMFInt32; 184 class SoMFLong; 185 class SoMFMatrix; 186 class SoMFName; 187 class SoMFNode; 188 class SoMFPath; 189 class SoMFPlane; 190 class SoMFRotation; 191 class SoMFShort; 192 class SoMFString; 193 class SoMFTime; 194 class SoMFUInt32; 195 class SoMFULong; 196 class SoMFUShort; 197 class SoMFVec2b; 198 class SoMFVec2s; 199 class SoMFVec2i32; 200 class SoMFVec2f; 201 class SoMFVec2d; 202 class SoMFVec3b; 203 class SoMFVec3s; 204 class SoMFVec3i32; 205 class SoMFVec3f; 206 class SoMFVec3d; 207 class SoMFVec4b; 208 class SoMFVec4ub; 209 class SoMFVec4s; 210 class SoMFVec4us; 211 class SoMFVec4i32; 212 class SoMFVec4ui32; 213 class SoMFVec4f; 214 class SoMFVec4d; 215 216 class SoEngine; 217 class SoNode; 218 class SoPath; 219 220 // ************************************************************************* 221 222 // namespace SIM { namespace Coin3D { namespace Coin { 223 224 template <typename T> 225 struct SbTypeInfo { 226 typedef T Type; 227 typedef const T & ParamType; 228 }; // fallback 229 230 template <> 231 struct SbTypeInfo<float> { 232 typedef float Type; 233 typedef float PrimitiveType; 234 enum { isPrimitive = 1 }; 235 236 typedef Type ParamType; 237 238 enum { Dimensions = 1 }; 239 240 typedef SbVec2f Vec2Type; 241 typedef SbVec3f Vec3Type; 242 typedef SbVec4f Vec4Type; 243 typedef SbBox2f Box2Type; 244 typedef SbBox3f Box3Type; 245 246 typedef SoSFFloat SFieldType; 247 typedef SoMFFloat MFieldType; 248 249 typedef SbPlane PlaneType; 250 typedef SbLine LineType; 251 typedef SbMatrix MatrixType; 252 typedef SbRotation RotationType; 253 }; 254 255 template<typename PrimitiveType, unsigned int dim> 256 struct Vec 257 { 258 }; 259 template<typename PrimitiveType> 260 struct Vec<PrimitiveType,2> 261 { 262 typedef typename SbTypeInfo<PrimitiveType>::Vec2Type Type; 263 }; 264 template<typename PrimitiveType> 265 struct Vec<PrimitiveType,3> 266 { 267 typedef typename SbTypeInfo<PrimitiveType>::Vec3Type Type; 268 }; 269 270 template<typename PrimitiveType> 271 struct Vec<PrimitiveType,4> 272 { 273 typedef typename SbTypeInfo<PrimitiveType>::Vec4Type Type; 274 }; 275 276 277 278 //This should have been a template for SbBool, but since SbBool is an 279 //int, we would risk unwanted behaviour for ints. 280 template <> 281 struct SbTypeInfo<bool> { 282 typedef bool Type; 283 typedef bool PrimitiveType; 284 enum { isPrimitive = 1 }; 285 286 typedef Type ParamType; 287 288 enum { Dimensions = 1 }; 289 290 typedef SoSFBool SFieldType; 291 typedef SoMFBool MFieldType; 292 }; 293 294 template <> 295 struct SbTypeInfo<double> { 296 typedef double Type; 297 typedef Type ParamType; 298 299 enum { isPrimitive = 1 }; 300 301 enum { Dimensions = 1 }; 302 303 typedef SbVec2d Vec2Type; 304 typedef SbVec3d Vec3Type; 305 typedef SbVec4d Vec4Type; 306 typedef SbBox2d Box2Type; 307 typedef SbBox3d Box3Type; 308 309 typedef SoSFDouble SFieldType; 310 typedef SoMFDouble MFieldType; 311 312 typedef SbDPPlane PlaneType; 313 typedef SbDPLine LineType; 314 typedef SbDPMatrix MatrixType; 315 typedef SbDPRotation RotationType; 316 }; 317 318 template <> 319 struct SbTypeInfo<int8_t> { 320 typedef int8_t Type; 321 typedef Type ParamType; 322 323 typedef SbVec2b Vec2Type; 324 typedef SbVec3b Vec3Type; 325 typedef SbVec4b Vec4Type; 326 }; 327 328 template <> 329 struct SbTypeInfo<uint8_t> { 330 typedef uint8_t Type; 331 typedef Type ParamType; 332 333 typedef SbVec2ub Vec2Type; 334 typedef SbVec3ub Vec3Type; 335 typedef SbVec4ub Vec4Type; 336 }; 337 338 template <> 339 struct SbTypeInfo<short> { 340 typedef short Type; 341 typedef Type ParamType; 342 343 enum { isPrimitive = 1 }; 344 345 typedef SbVec2s Vec2Type; 346 typedef SbVec3s Vec3Type; 347 typedef SbVec4s Vec4Type; 348 typedef SbBox2s Box2Type; 349 typedef SbBox3s Box3Type; 350 351 typedef SoSFShort SFieldType; 352 typedef SoMFShort MFieldType; 353 }; 354 355 template <> 356 struct SbTypeInfo<unsigned short> { 357 typedef unsigned short Type; 358 typedef Type ParamType; 359 360 typedef SbVec2us Vec2Type; 361 typedef SbVec3us Vec3Type; 362 typedef SbVec4us Vec4Type; 363 364 typedef SoSFUShort SFieldType; 365 typedef SoMFUShort MFieldType; 366 }; 367 368 template <> 369 struct SbTypeInfo<int32_t> { 370 typedef int32_t Type; 371 typedef Type ParamType; 372 373 typedef SbVec2i32 Vec2Type; 374 typedef SbVec3i32 Vec3Type; 375 typedef SbVec4i32 Vec4Type; 376 typedef SbBox2i32 Box2Type; 377 typedef SbBox3i32 Box3Type; 378 379 typedef SoSFInt32 SFieldType; 380 typedef SoMFInt32 MFieldType; 381 }; 382 383 template <> 384 struct SbTypeInfo<uint32_t> { 385 typedef uint32_t Type; 386 typedef Type ParamType; 387 388 typedef SbVec2ui32 Vec2Type; 389 typedef SbVec3ui32 Vec3Type; 390 typedef SbVec4ui32 Vec4Type; 391 392 typedef SoSFUInt32 SFieldType; 393 typedef SoMFUInt32 MFieldType; 394 }; 395 396 397 template <> 398 struct SbTypeInfo<SbVec2f> { 399 typedef SbVec2f Type; 400 typedef const Type & ParamType; 401 402 typedef float PrimitiveType; 403 enum { isPrimitive = 0 }; 404 405 enum { Dimensions = 2 }; 406 407 typedef SbBox2f BoxType; 408 409 typedef SoSFVec2f SFieldType; 410 typedef SoMFVec2f MFieldType; 411 412 static const char * getTypeName() { return "SbVec2f"; } 413 }; 414 415 template <> 416 struct SbTypeInfo<SbVec2d> { 417 typedef SbVec2d Type; 418 typedef const Type & ParamType; 419 420 typedef double PrimitiveType; 421 enum { Dimensions = 2 }; 422 423 typedef SbBox2d BoxType; 424 425 typedef SoSFVec2d SFieldType; 426 typedef SoMFVec2d MFieldType; 427 }; 428 429 template <> 430 struct SbTypeInfo<SbVec2b> { 431 typedef SbVec2b Type; 432 typedef Type ParamType; 433 434 typedef int8_t PrimitiveType; 435 enum { Dimensions = 2 }; 436 437 typedef SoSFVec2b SFieldType; 438 typedef SoMFVec2b MFieldType; 439 }; 440 441 template <> 442 struct SbTypeInfo<SbVec2ub> { 443 typedef SbVec2ub Type; 444 typedef Type ParamType; 445 446 typedef uint8_t PrimitiveType; 447 enum { Dimensions = 2 }; 448 }; 449 450 template <> 451 struct SbTypeInfo<SbVec2s> { 452 typedef SbVec2s Type; 453 typedef Type ParamType; 454 455 typedef short PrimitiveType; 456 enum { isPrimitive = 0 }; 457 458 enum { Dimensions = 2 }; 459 460 typedef SbBox2s BoxType; 461 462 typedef SoSFVec2s SFieldType; 463 typedef SoMFVec2s MFieldType; 464 465 static const char * getTypeName() { return "SbVec2s"; } 466 }; 467 468 template <> 469 struct SbTypeInfo<SbVec2us> { 470 typedef SbVec2us Type; 471 typedef Type ParamType; 472 473 typedef unsigned short PrimitiveType; 474 enum { Dimensions = 2 }; 475 }; 476 477 template <> 478 struct SbTypeInfo<SbVec2i32> { 479 typedef SbVec2i32 Type; 480 typedef const Type & ParamType; 481 482 typedef int32_t PrimitiveType; 483 enum { Dimensions = 2 }; 484 485 typedef SbBox2i32 BoxType; 486 487 typedef SoSFVec2i32 SFieldType; 488 typedef SoMFVec2i32 MFieldType; 489 }; 490 491 template <> 492 struct SbTypeInfo<SbVec2ui32> { 493 typedef SbVec2ui32 Type; 494 typedef const Type & ParamType; 495 496 typedef uint32_t PrimitiveType; 497 enum { Dimensions = 2 }; 498 }; 499 500 template <> 501 struct SbTypeInfo<SbVec3f> { 502 typedef SbVec3f Type; 503 typedef const Type & ParamType; 504 505 typedef float PrimitiveType; 506 enum { isPrimitive = 0 }; 507 508 enum { Dimensions = 3 }; 509 510 typedef SbBox3f BoxType; 511 512 typedef SoSFVec3f SFieldType; 513 typedef SoMFVec3f MFieldType; 514 515 static const char * getTypeName() { return "SbVec3f"; } 516 }; 517 518 template <> 519 struct SbTypeInfo<SbVec3d> { 520 typedef SbVec3d Type; 521 typedef const Type & ParamType; 522 523 typedef double PrimitiveType; 524 enum { Dimensions = 3 }; 525 526 typedef SbBox3d BoxType; 527 528 typedef SoSFVec3d SFieldType; 529 typedef SoMFVec3d MFieldType; 530 }; 531 532 template <> 533 struct SbTypeInfo<SbVec3b> { 534 typedef SbVec3b Type; 535 typedef Type ParamType; 536 537 typedef int8_t PrimitiveType; 538 enum { Dimensions = 3 }; 539 540 typedef SoSFVec3b SFieldType; 541 typedef SoMFVec3b MFieldType; 542 }; 543 544 template <> 545 struct SbTypeInfo<SbVec3ub> { 546 typedef SbVec3ub Type; 547 typedef Type ParamType; 548 549 typedef uint8_t PrimitiveType; 550 enum { Dimensions = 3 }; 551 }; 552 553 template <> 554 struct SbTypeInfo<SbVec3s> { 555 typedef SbVec3s Type; 556 typedef const Type & ParamType; 557 558 typedef short PrimitiveType; 559 enum { isPrimitive = 0 }; 560 561 enum { Dimensions = 3 }; 562 563 typedef SbBox3s BoxType; 564 565 typedef SoSFVec3s SFieldType; 566 typedef SoMFVec3s MFieldType; 567 568 static const char * getTypeName() { return "SbVec3s"; } 569 }; 570 571 template <> 572 struct SbTypeInfo<SbVec3us> { 573 typedef SbVec3us Type; 574 typedef const Type & ParamType; 575 576 typedef unsigned short PrimitiveType; 577 enum { Dimensions = 3 }; 578 579 static const char * getTypeName() { return "SbVec3us"; } 580 }; 581 582 template <> 583 struct SbTypeInfo<SbVec3i32> { 584 typedef SbVec3i32 Type; 585 typedef const Type & ParamType; 586 587 typedef int32_t PrimitiveType; 588 enum { Dimensions = 3 }; 589 590 typedef SbBox3i32 BoxType; 591 592 typedef SoSFVec3i32 SFieldType; 593 typedef SoMFVec3i32 MFieldType; 594 }; 595 596 template <> 597 struct SbTypeInfo<SbVec3ui32> { 598 typedef SbVec3ui32 Type; 599 typedef const Type & ParamType; 600 601 typedef uint32_t PrimitiveType; 602 enum { Dimensions = 3 }; 603 }; 604 605 template <> 606 struct SbTypeInfo<SbVec4f> { 607 typedef SbVec4f Type; 608 typedef const Type & ParamType; 609 610 typedef float PrimitiveType; 611 enum { Dimensions = 4 }; 612 613 typedef SoSFVec4f SFieldType; 614 typedef SoMFVec4f MFieldType; 615 }; 616 617 template <> 618 struct SbTypeInfo<SbVec4d> { 619 typedef SbVec4d Type; 620 typedef const Type & ParamType; 621 622 typedef double PrimitiveType; 623 enum { Dimensions = 4 }; 624 625 typedef SoSFVec4d SFieldType; 626 typedef SoMFVec4d MFieldType; 627 }; 628 629 template <> 630 struct SbTypeInfo<SbVec4b> { 631 typedef SbVec4b Type; 632 typedef Type ParamType; 633 634 typedef int8_t PrimitiveType; 635 enum { Dimensions = 4 }; 636 637 typedef SoSFVec4b SFieldType; 638 typedef SoMFVec4b MFieldType; 639 }; 640 641 template <> 642 struct SbTypeInfo<SbVec4ub> { 643 typedef SbVec4ub Type; 644 typedef Type ParamType; 645 646 typedef uint8_t PrimitiveType; 647 enum { Dimensions = 4 }; 648 649 typedef SoSFVec4ub SFieldType; 650 typedef SoMFVec4ub MFieldType; 651 }; 652 653 template <> 654 struct SbTypeInfo<SbVec4s> { 655 typedef SbVec4s Type; 656 typedef const Type & ParamType; 657 658 typedef short PrimitiveType; 659 enum { Dimensions = 4 }; 660 661 typedef SoSFVec4s SFieldType; 662 typedef SoMFVec4s MFieldType; 663 }; 664 665 template <> 666 struct SbTypeInfo<SbVec4us> { 667 typedef SbVec4us Type; 668 typedef const Type & ParamType; 669 670 typedef unsigned short PrimitiveType; 671 enum { Dimensions = 4 }; 672 673 typedef SoSFVec4us SFieldType; 674 typedef SoMFVec4us MFieldType; 675 }; 676 677 template <> 678 struct SbTypeInfo<SbVec4i32> { 679 typedef SbVec4i32 Type; 680 typedef const Type & ParamType; 681 682 typedef int32_t PrimitiveType; 683 enum { Dimensions = 4 }; 684 685 typedef SoSFVec4i32 SFieldType; 686 typedef SoMFVec4i32 MFieldType; 687 }; 688 689 template <> 690 struct SbTypeInfo<SbVec4ui32> { 691 typedef SbVec4ui32 Type; 692 typedef const Type & ParamType; 693 694 typedef uint32_t PrimitiveType; 695 enum { Dimensions = 4 }; 696 697 typedef SoSFVec4ui32 SFieldType; 698 typedef SoMFVec4ui32 MFieldType; 699 }; 700 701 template <> 702 struct SbTypeInfo<SbBox2f> { 703 typedef SbBox2f Type; 704 typedef const Type & ParamType; 705 706 typedef float PrimitiveType; 707 enum { Dimensions = 2 }; 708 709 typedef SbVec2f VecType; 710 711 typedef SoSFBox2f SFieldType; 712 }; 713 714 template <> 715 struct SbTypeInfo<SbBox2d> { 716 typedef SbBox2d Type; 717 typedef const Type & ParamType; 718 719 typedef double PrimitiveType; 720 enum { Dimensions = 2 }; 721 722 typedef SbVec2d VecType; 723 724 typedef SoSFBox2d SFieldType; 725 }; 726 727 template <> 728 struct SbTypeInfo<SbBox2s> { 729 typedef SbBox2s Type; 730 typedef const Type & ParamType; 731 732 typedef short PrimitiveType; 733 enum { Dimensions = 2 }; 734 735 typedef SbVec2s VecType; 736 737 typedef SoSFBox2s SFieldType; 738 }; 739 740 template <> 741 struct SbTypeInfo<SbBox2i32> { 742 typedef SbBox2i32 Type; 743 typedef const Type & ParamType; 744 745 typedef int32_t PrimitiveType; 746 enum { Dimensions = 2 }; 747 748 typedef SbVec2i32 VecType; 749 750 typedef SoSFBox2i32 SFieldType; 751 }; 752 753 template <> 754 struct SbTypeInfo<SbBox3f> { 755 typedef SbBox3f Type; 756 typedef const Type & ParamType; 757 758 typedef float PrimitiveType; 759 enum { Dimensions = 3 }; 760 761 typedef SbVec3f VecType; 762 763 typedef SoSFBox3f SFieldType; 764 }; 765 766 template <> 767 struct SbTypeInfo<SbBox3d> { 768 typedef SbBox3d Type; 769 typedef const Type & ParamType; 770 771 typedef double PrimitiveType; 772 enum { Dimensions = 3 }; 773 774 typedef SbVec3d VecType; 775 776 typedef SoSFBox3d SFieldType; 777 }; 778 779 template <> 780 struct SbTypeInfo<SbBox3s> { 781 typedef SbBox3s Type; 782 typedef const Type & ParamType; 783 784 typedef short PrimitiveType; 785 enum { Dimensions = 3 }; 786 787 typedef SbVec3s VecType; 788 789 typedef SoSFBox3s SFieldType; 790 }; 791 792 template <> 793 struct SbTypeInfo<SbBox3i32> { 794 typedef SbBox3i32 Type; 795 typedef const Type & ParamType; 796 797 typedef int32_t PrimitiveType; 798 enum { Dimensions = 3 }; 799 800 typedef SbVec3i32 VecType; 801 802 typedef SoSFBox3i32 SFieldType; 803 }; 804 805 template <> 806 struct SbTypeInfo<SbPlane> { 807 typedef SbPlane Type; 808 typedef const Type & ParamType; 809 810 typedef float PrimitiveType; 811 enum { Dimensions = 3 }; 812 813 typedef SoSFPlane SFieldType; 814 typedef SoMFPlane MFieldType; 815 }; 816 817 template <> 818 struct SbTypeInfo<SbDPPlane> { 819 typedef SbDPPlane Type; 820 typedef const Type & ParamType; 821 822 typedef double PrimitiveType; 823 enum { Dimensions = 3 }; 824 }; 825 826 template <> 827 struct SbTypeInfo<SbLine> { 828 typedef SbLine Type; 829 typedef const Type & ParamType; 830 831 typedef float PrimitiveType; 832 enum { Dimensions = 3 }; 833 }; 834 835 template <> 836 struct SbTypeInfo<SbDPLine> { 837 typedef SbDPLine Type; 838 typedef const Type & ParamType; 839 840 typedef double PrimitiveType; 841 enum { Dimensions = 3 }; 842 }; 843 844 template <> 845 struct SbTypeInfo<SbRotation> { 846 typedef SbRotation Type; 847 typedef const Type & ParamType; 848 849 typedef float PrimitiveType; 850 enum { isPrimitive = 0 }; 851 852 typedef SoSFRotation SFieldType; 853 typedef SoMFRotation MFieldType; 854 855 enum { Dimensions = 4 }; 856 static const char * getTypeName() { return "SbRotation"; } 857 }; 858 859 template <> 860 struct SbTypeInfo<SbDPRotation> { 861 typedef SbDPRotation Type; 862 typedef const Type & ParamType; 863 864 typedef double PrimitiveType; 865 }; 866 867 template <> 868 struct SbTypeInfo<SbMatrix> { 869 typedef SbMatrix Type; 870 typedef const Type & ParamType; 871 872 typedef float PrimitiveType; 873 874 typedef SoSFMatrix SFieldType; 875 typedef SoMFMatrix MFieldType; 876 }; 877 878 template <> 879 struct SbTypeInfo<SbDPMatrix> { 880 typedef SbDPMatrix Type; 881 typedef const Type & ParamType; 882 883 typedef double PrimitiveType; 884 }; 885 886 // ************************************************************************* 887 888 template<> 889 struct SbTypeInfo<SoSFBitMask> { 890 typedef SoSFBitMask Type; 891 typedef int32_t DataType; 892 }; 893 894 template<> 895 struct SbTypeInfo<SoSFBool> { 896 typedef SoSFBool Type; 897 typedef SbBool DataType; 898 }; 899 900 template<> 901 struct SbTypeInfo<SoSFBox2d> { 902 typedef SoSFBox2d Type; 903 typedef SbBox2d DataType; 904 }; 905 906 template<> 907 struct SbTypeInfo<SoSFBox2f> { 908 typedef SoSFBox2f Type; 909 typedef SbBox2f DataType; 910 }; 911 912 template<> 913 struct SbTypeInfo<SoSFBox2i32> { 914 typedef SoSFBox2i32 Type; 915 typedef SbBox2i32 DataType; 916 }; 917 918 template<> 919 struct SbTypeInfo<SoSFBox2s> { 920 typedef SoSFBox2s Type; 921 typedef SbBox2s DataType; 922 }; 923 924 template<> 925 struct SbTypeInfo<SoSFBox3d> { 926 typedef SoSFBox3d Type; 927 typedef SbBox3d DataType; 928 }; 929 930 template<> 931 struct SbTypeInfo<SoSFBox3f> { 932 typedef SoSFBox3f Type; 933 typedef SbBox3f DataType; 934 }; 935 936 template<> 937 struct SbTypeInfo<SoSFBox3i32> { 938 typedef SoSFBox3i32 Type; 939 typedef SbBox3i32 DataType; 940 }; 941 942 template<> 943 struct SbTypeInfo<SoSFBox3s> { 944 typedef SoSFBox3s Type; 945 typedef SbBox3s DataType; 946 }; 947 948 template<> 949 struct SbTypeInfo<SoSFColor> { 950 typedef SoSFColor Type; 951 typedef SbColor DataType; 952 }; 953 954 template<> 955 struct SbTypeInfo<SoSFColorRGBA> { 956 typedef SoSFColorRGBA Type; 957 typedef SbColor4f DataType; 958 }; 959 960 template<> 961 struct SbTypeInfo<SoSFDouble> { 962 typedef SoSFDouble Type; 963 typedef double DataType; 964 }; 965 966 template<> 967 struct SbTypeInfo<SoSFEngine> { 968 typedef SoSFEngine Type; 969 typedef SoEngine * DataType; 970 }; 971 972 template<> 973 struct SbTypeInfo<SoSFEnum> { 974 typedef SoSFEnum Type; 975 typedef int32_t DataType; 976 }; 977 978 template<> 979 struct SbTypeInfo<SoSFFloat> { 980 typedef SoSFFloat Type; 981 typedef float DataType; 982 }; 983 984 //template<> 985 //struct SbTypeInfo<SoSFImage3> { 986 // typedef SoSFImage3 Type; 987 // typedef SoImage3 DataType; 988 //}; 989 990 template<> 991 struct SbTypeInfo<SoSFImage> { 992 typedef SoSFImage Type; 993 // typedef SbImage DataType; 994 }; 995 996 template<> 997 struct SbTypeInfo<SoSFInt32> { 998 typedef SoSFInt32 Type; 999 typedef int32_t DataType; 1000 }; 1001 1002 template<> 1003 struct SbTypeInfo<SoSFMatrix> { 1004 typedef SoSFMatrix Type; 1005 typedef SbMatrix DataType; 1006 }; 1007 1008 template<> 1009 struct SbTypeInfo<SoSFName> { 1010 typedef SoSFName Type; 1011 typedef SbName DataType; 1012 }; 1013 1014 template<> 1015 struct SbTypeInfo<SoSFNode> { 1016 typedef SoSFNode Type; 1017 typedef SoNode * DataType; 1018 }; 1019 1020 template<> 1021 struct SbTypeInfo<SoSFPath> { 1022 typedef SoSFPath Type; 1023 typedef SoPath * DataType; 1024 }; 1025 1026 template<> 1027 struct SbTypeInfo<SoSFPlane> { 1028 typedef SoSFPlane Type; 1029 typedef SbPlane DataType; 1030 }; 1031 1032 template<> 1033 struct SbTypeInfo<SoSFRotation> { 1034 typedef SoSFRotation Type; 1035 typedef SbRotation DataType; 1036 }; 1037 1038 template<> 1039 struct SbTypeInfo<SoSFShort> { 1040 typedef SoSFShort Type; 1041 typedef short DataType; 1042 }; 1043 1044 template<> 1045 struct SbTypeInfo<SoSFString> { 1046 typedef SoSFString Type; 1047 typedef SbString DataType; 1048 }; 1049 1050 template<> 1051 struct SbTypeInfo<SoSFTime> { 1052 typedef SoSFTime Type; 1053 typedef SbTime DataType; 1054 }; 1055 1056 //template<> 1057 //struct SbTypeInfo<SoSFTrigger> { 1058 // typedef SoSFTrigger Type; 1059 // typedef SoTrigger DataType; 1060 //}; 1061 1062 template<> 1063 struct SbTypeInfo<SoSFUInt32> { 1064 typedef SoSFUInt32 Type; 1065 typedef uint32_t DataType; 1066 }; 1067 1068 template<> 1069 struct SbTypeInfo<SoSFUShort> { 1070 typedef SoSFUShort Type; 1071 typedef unsigned short DataType; 1072 }; 1073 1074 template<> 1075 struct SbTypeInfo<SoSFVec2b> { 1076 typedef SoSFVec2b Type; 1077 typedef SbVec2b DataType; 1078 }; 1079 1080 template<> 1081 struct SbTypeInfo<SoSFVec2d> { 1082 typedef SoSFVec2d Type; 1083 typedef SbVec2d DataType; 1084 }; 1085 1086 template<> 1087 struct SbTypeInfo<SoSFVec2f> { 1088 typedef SoSFVec2f Type; 1089 typedef SbVec2f DataType; 1090 }; 1091 1092 template<> 1093 struct SbTypeInfo<SoSFVec2i32> { 1094 typedef SoSFVec2i32 Type; 1095 typedef SbVec2i32 DataType; 1096 }; 1097 1098 template<> 1099 struct SbTypeInfo<SoSFVec2s> { 1100 typedef SoSFVec2s Type; 1101 typedef SbVec2s DataType; 1102 }; 1103 1104 template<> 1105 struct SbTypeInfo<SoSFVec3b> { 1106 typedef SoSFVec3b Type; 1107 typedef SbVec3b DataType; 1108 }; 1109 1110 template<> 1111 struct SbTypeInfo<SoSFVec3d> { 1112 typedef SoSFVec3d Type; 1113 typedef SbVec3d DataType; 1114 }; 1115 1116 template<> 1117 struct SbTypeInfo<SoSFVec3f> { 1118 typedef SoSFVec3f Type; 1119 typedef SbVec3f DataType; 1120 }; 1121 1122 template<> 1123 struct SbTypeInfo<SoSFVec3i32> { 1124 typedef SoSFVec3i32 Type; 1125 typedef SbVec3i32 DataType; 1126 }; 1127 1128 template<> 1129 struct SbTypeInfo<SoSFVec3s> { 1130 typedef SoSFVec3s Type; 1131 typedef SbVec3s DataType; 1132 }; 1133 1134 template<> 1135 struct SbTypeInfo<SoSFVec4b> { 1136 typedef SoSFVec4b Type; 1137 typedef SbVec4b DataType; 1138 }; 1139 1140 template<> 1141 struct SbTypeInfo<SoSFVec4d> { 1142 typedef SoSFVec4d Type; 1143 typedef SbVec4d DataType; 1144 }; 1145 1146 template<> 1147 struct SbTypeInfo<SoSFVec4f> { 1148 typedef SoSFVec4f Type; 1149 typedef SbVec4f DataType; 1150 }; 1151 1152 template<> 1153 struct SbTypeInfo<SoSFVec4i32> { 1154 typedef SoSFVec4i32 Type; 1155 typedef SbVec4i32 DataType; 1156 }; 1157 1158 template<> 1159 struct SbTypeInfo<SoSFVec4s> { 1160 typedef SoSFVec4s Type; 1161 typedef SbVec4s DataType; 1162 }; 1163 1164 template<> 1165 struct SbTypeInfo<SoSFVec4ub> { 1166 typedef SoSFVec4ub Type; 1167 typedef SbVec4ub DataType; 1168 }; 1169 1170 template<> 1171 struct SbTypeInfo<SoSFVec4ui32> { 1172 typedef SoSFVec4ui32 Type; 1173 typedef SbVec4ui32 DataType; 1174 }; 1175 1176 template<> 1177 struct SbTypeInfo<SoSFVec4us> { 1178 typedef SoSFVec4us Type; 1179 typedef SbVec4us DataType; 1180 }; 1181 1182 template<> 1183 struct SbTypeInfo<SoMFBitMask> { 1184 typedef SoMFBitMask Type; 1185 typedef int32_t DataType; 1186 }; 1187 1188 template<> 1189 struct SbTypeInfo<SoMFBool> { 1190 typedef SoMFBool Type; 1191 typedef SbBool DataType; 1192 }; 1193 1194 template<> 1195 struct SbTypeInfo<SoMFColor> { 1196 typedef SoMFColor Type; 1197 typedef SbColor DataType; 1198 }; 1199 1200 template<> 1201 struct SbTypeInfo<SoMFColorRGBA> { 1202 typedef SoMFColorRGBA Type; 1203 typedef SbColor4f DataType; 1204 }; 1205 1206 template<> 1207 struct SbTypeInfo<SoMFDouble> { 1208 typedef SoMFDouble Type; 1209 typedef double DataType; 1210 }; 1211 1212 template<> 1213 struct SbTypeInfo<SoMFEngine> { 1214 typedef SoMFEngine Type; 1215 typedef SoEngine * DataType; 1216 }; 1217 1218 template<> 1219 struct SbTypeInfo<SoMFEnum> { 1220 typedef SoMFEnum Type; 1221 typedef int32_t DataType; 1222 }; 1223 1224 template<> 1225 struct SbTypeInfo<SoMFFloat> { 1226 typedef SoMFFloat Type; 1227 typedef float DataType; 1228 }; 1229 1230 template<> 1231 struct SbTypeInfo<SoMFInt32> { 1232 typedef SoMFInt32 Type; 1233 typedef int32_t DataType; 1234 }; 1235 1236 template<> 1237 struct SbTypeInfo<SoMFMatrix> { 1238 typedef SoMFMatrix Type; 1239 typedef SbMatrix DataType; 1240 }; 1241 1242 template<> 1243 struct SbTypeInfo<SoMFName> { 1244 typedef SoSFVec4us Type; 1245 typedef SbVec4us DataType; 1246 }; 1247 1248 template<> 1249 struct SbTypeInfo<SoMFNode> { 1250 typedef SoMFNode Type; 1251 typedef SoNode * DataType; 1252 }; 1253 1254 template<> 1255 struct SbTypeInfo<SoMFPath> { 1256 typedef SoMFPath Type; 1257 typedef SoPath * DataType; 1258 }; 1259 1260 template<> 1261 struct SbTypeInfo<SoMFPlane> { 1262 typedef SoMFPlane Type; 1263 typedef SbPlane DataType; 1264 }; 1265 1266 template<> 1267 struct SbTypeInfo<SoMFRotation> { 1268 typedef SoMFRotation Type; 1269 typedef SbRotation DataType; 1270 }; 1271 1272 template<> 1273 struct SbTypeInfo<SoMFShort> { 1274 typedef SoMFShort Type; 1275 typedef short DataType; 1276 }; 1277 1278 template<> 1279 struct SbTypeInfo<SoMFString> { 1280 typedef SoMFString Type; 1281 typedef SbString DataType; 1282 }; 1283 1284 template<> 1285 struct SbTypeInfo<SoMFTime> { 1286 typedef SoMFTime Type; 1287 typedef SbTime DataType; 1288 }; 1289 1290 template<> 1291 struct SbTypeInfo<SoMFUInt32> { 1292 typedef SoMFUInt32 Type; 1293 typedef uint32_t DataType; 1294 }; 1295 1296 template<> 1297 struct SbTypeInfo<SoMFUShort> { 1298 typedef SoMFUShort Type; 1299 typedef unsigned short DataType; 1300 }; 1301 1302 template<> 1303 struct SbTypeInfo<SoMFVec2b> { 1304 typedef SoMFVec2b Type; 1305 typedef SbVec2b DataType; 1306 }; 1307 1308 template<> 1309 struct SbTypeInfo<SoMFVec2d> { 1310 typedef SoMFVec2d Type; 1311 typedef SbVec2d DataType; 1312 }; 1313 1314 template<> 1315 struct SbTypeInfo<SoMFVec2f> { 1316 typedef SoMFVec2f Type; 1317 typedef SbVec2f DataType; 1318 }; 1319 1320 template<> 1321 struct SbTypeInfo<SoMFVec2i32> { 1322 typedef SoMFVec2i32 Type; 1323 typedef SbVec2i32 DataType; 1324 }; 1325 1326 template<> 1327 struct SbTypeInfo<SoMFVec2s> { 1328 typedef SoMFVec2s Type; 1329 typedef SbVec2s DataType; 1330 }; 1331 1332 template<> 1333 struct SbTypeInfo<SoMFVec3b> { 1334 typedef SoMFVec3b Type; 1335 typedef SbVec3b DataType; 1336 }; 1337 1338 template<> 1339 struct SbTypeInfo<SoMFVec3d> { 1340 typedef SoMFVec3d Type; 1341 typedef SbVec3d DataType; 1342 }; 1343 1344 template<> 1345 struct SbTypeInfo<SoMFVec3f> { 1346 typedef SoMFVec3f Type; 1347 typedef SbVec3f DataType; 1348 }; 1349 1350 template<> 1351 struct SbTypeInfo<SoMFVec3i32> { 1352 typedef SoMFVec3i32 Type; 1353 typedef SbVec3i32 DataType; 1354 }; 1355 1356 template<> 1357 struct SbTypeInfo<SoMFVec3s> { 1358 typedef SoMFVec3s Type; 1359 typedef SbVec3s DataType; 1360 }; 1361 1362 template<> 1363 struct SbTypeInfo<SoMFVec4b> { 1364 typedef SoMFVec4b Type; 1365 typedef SbVec4b DataType; 1366 }; 1367 1368 template<> 1369 struct SbTypeInfo<SoMFVec4d> { 1370 typedef SoMFVec4d Type; 1371 typedef SbVec4d DataType; 1372 }; 1373 1374 template<> 1375 struct SbTypeInfo<SoMFVec4f> { 1376 typedef SoMFVec4f Type; 1377 typedef SbVec4f DataType; 1378 }; 1379 1380 template<> 1381 struct SbTypeInfo<SoMFVec4i32> { 1382 typedef SoMFVec4i32 Type; 1383 typedef SbVec4i32 DataType; 1384 }; 1385 1386 template<> 1387 struct SbTypeInfo<SoMFVec4s> { 1388 typedef SoMFVec4s Type; 1389 typedef SbVec4s DataType; 1390 }; 1391 1392 template<> 1393 struct SbTypeInfo<SoMFVec4ub> { 1394 typedef SoMFVec4ub Type; 1395 typedef SbVec4ub DataType; 1396 }; 1397 1398 template<> 1399 struct SbTypeInfo<SoMFVec4ui32> { 1400 typedef SoMFVec4ui32 Type; 1401 typedef SbVec4ui32 DataType; 1402 }; 1403 1404 template<> 1405 struct SbTypeInfo<SoMFVec4us> { 1406 typedef SoMFVec4us Type; 1407 typedef SbVec4us DataType; 1408 }; 1409 1410 // ************************************************************************* 1411 1412 // } } } // namespace SIM::Coin3D::Coin 1413 1414 #endif // !DOXYGEN_SKIP_THIS 1415 1416 #endif // !COIN_SBTYPEINFO_H 1417