fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Base / Field / OSGVecFieldTraits.h
blobbcda1f41a265bf061544f2f98f5e931f80a55c72
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 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 _OSGVECFIELDTRAITS_H_
40 #define _OSGVECFIELDTRAITS_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGFieldTraits.h"
46 #include "OSGDataType.h"
47 #include "OSGVector.h"
49 OSG_BEGIN_NAMESPACE
51 #undef defineTrait
52 #undef doDefineTrait
54 #define doDefineTrait(base, dim, type) \
55 /*! \ingroup GrpBaseFieldTraits \
56 \ingroup GrpLibOSGBase
57 */ \
58 template <> \
59 struct FieldTraits<base##dim##type> : \
60 public FieldTraitsVec##dim##TemplateBase<base##dim##type> \
61 { \
62 private: \
64 static DataType _type; \
66 public: \
68 typedef FieldTraits<base##dim##type> Self; \
71 enum { Convertible = (Self::ToStreamConvertible | \
72 Self::FromStringConvertible) }; \
74 enum { bHasParent = 0x01 }; \
76 static OSG_BASE_DLLMAPPING \
77 DataType &getType (void); \
79 static const Char8 *getSName(void) { return "SF"#base #dim #type; } \
80 static const Char8 *getMName(void) { return "MF"#base #dim #type; } \
82 static base##dim##type getDefault (void) { return base##dim##type();} \
87 #define defineTrait(base, dim, type) \
88 doDefineTrait(base, dim, type);
91 // Filler Macros
92 #undef defineBTrait
93 #define defineBTrait(dim, type) \
94 defineTrait(Vec, dim, type) \
95 defineTrait(Pnt, dim, type)
97 #undef defineBTraitV
98 #define defineBTraitV(dim, type) \
99 defineTrait(Vec, dim, type)
101 #undef defineDTrait
102 #define defineDTrait(type) \
103 defineBTrait(1, type) \
104 defineBTrait(2, type) \
105 defineBTrait(3, type) \
106 defineBTrait(4, type)
108 #undef defineDTraitV
109 #define defineDTraitV(type) \
110 defineBTraitV(1, type) \
111 defineBTraitV(2, type) \
112 defineBTraitV(3, type) \
113 defineBTraitV(4, type)
116 // Actual Instantiations
118 defineDTrait(ub)
119 #ifndef OSG_NO_INT8_PNT
120 defineDTrait( b)
121 #endif
122 defineDTrait(us)
123 defineDTrait( s)
124 defineDTraitV( u)
125 defineDTraitV( i)
126 defineDTrait( f)
127 defineDTrait( d)
128 defineDTrait(ld)
130 defineDTrait(fx)
132 OSG_END_NAMESPACE
134 #endif /* _OSGVECFIELDTRAITS_H_ */