24 #ifndef PXR_BASE_VT_TYPES_H
25 #define PXR_BASE_VT_TYPES_H
31 #include "pxr/base/vt/api.h"
38 #include <boost/preprocessor/cat.hpp>
39 #include <boost/preprocessor/seq/for_each.hpp>
40 #include <boost/preprocessor/tuple/elem.hpp>
46 PXR_NAMESPACE_OPEN_SCOPE
50 VT_TYPE_IS_CHEAP_TO_COPY(
TfToken);
54 #define VT_FLOATING_POINT_BUILTIN_VALUE_TYPES \
55 (( double, Double )) \
59 #define VT_INTEGRAL_BUILTIN_VALUE_TYPES \
62 (( unsigned char, UChar )) \
64 (( unsigned short, UShort )) \
66 (( unsigned int, UInt )) \
67 (( int64_t, Int64 )) \
68 (( uint64_t, UInt64 ))
70 #define VT_VEC_INT_VALUE_TYPES \
71 (( GfVec4i, Vec4i )) \
72 (( GfVec3i, Vec3i )) \
75 #define VT_VEC_HALF_VALUE_TYPES \
76 (( GfVec4h, Vec4h )) \
77 (( GfVec3h, Vec3h )) \
80 #define VT_VEC_FLOAT_VALUE_TYPES \
81 (( GfVec4f, Vec4f )) \
82 (( GfVec3f, Vec3f )) \
85 #define VT_VEC_DOUBLE_VALUE_TYPES \
86 (( GfVec4d, Vec4d )) \
87 (( GfVec3d, Vec3d )) \
90 #define VT_VEC_VALUE_TYPES \
91 VT_VEC_INT_VALUE_TYPES \
92 VT_VEC_HALF_VALUE_TYPES \
93 VT_VEC_FLOAT_VALUE_TYPES \
94 VT_VEC_DOUBLE_VALUE_TYPES
96 #define VT_MATRIX_FLOAT_VALUE_TYPES \
97 (( GfMatrix4f, Matrix4f )) \
98 (( GfMatrix3f, Matrix3f )) \
99 (( GfMatrix2f, Matrix2f )) \
101 #define VT_MATRIX_DOUBLE_VALUE_TYPES \
102 (( GfMatrix4d, Matrix4d )) \
103 (( GfMatrix3d, Matrix3d )) \
104 (( GfMatrix2d, Matrix2d ))
106 #define VT_MATRIX_VALUE_TYPES \
107 VT_MATRIX_FLOAT_VALUE_TYPES \
108 VT_MATRIX_DOUBLE_VALUE_TYPES \
110 #define VT_GFRANGE_VALUE_TYPES \
111 (( GfRange3f, Range3f )) \
112 (( GfRange3d, Range3d )) \
113 (( GfRange2f, Range2f )) \
114 (( GfRange2d, Range2d )) \
115 (( GfRange1f, Range1f )) \
116 (( GfRange1d, Range1d ))
118 #define VT_RANGE_VALUE_TYPES \
119 VT_GFRANGE_VALUE_TYPES \
120 (( GfInterval, Interval )) \
121 (( GfRect2i, Rect2i ))
123 #define VT_STRING_VALUE_TYPES \
124 (( std::string, String )) \
127 #define VT_QUATERNION_VALUE_TYPES \
128 (( GfQuath, Quath )) \
129 (( GfQuatf, Quatf )) \
130 (( GfQuatd, Quatd )) \
131 (( GfQuaternion, Quaternion ))
133 #define VT_NONARRAY_VALUE_TYPES \
134 (( GfFrustum, Frustum)) \
135 (( GfMultiInterval, MultiInterval))
138 #define VT_TYPE(elem) \
139 BOOST_PP_TUPLE_ELEM(2, 0, elem)
140 #define VT_TYPE_NAME(elem) \
141 BOOST_PP_TUPLE_ELEM(2, 1, elem)
145 #define VT_BUILTIN_NUMERIC_VALUE_TYPES \
146 VT_INTEGRAL_BUILTIN_VALUE_TYPES VT_FLOATING_POINT_BUILTIN_VALUE_TYPES
148 #define VT_BUILTIN_VALUE_TYPES \
149 VT_BUILTIN_NUMERIC_VALUE_TYPES VT_STRING_VALUE_TYPES
151 #define VT_SCALAR_CLASS_VALUE_TYPES \
153 VT_MATRIX_VALUE_TYPES \
154 VT_RANGE_VALUE_TYPES \
155 VT_QUATERNION_VALUE_TYPES
157 #define VT_SCALAR_VALUE_TYPES \
158 VT_SCALAR_CLASS_VALUE_TYPES VT_BUILTIN_VALUE_TYPES
166 template<
typename T>
class VtArray;
167 #define VT_ARRAY_TYPEDEF(r, unused, elem) \
168 typedef VtArray< VT_TYPE(elem) > \
169 BOOST_PP_CAT(Vt, BOOST_PP_CAT(VT_TYPE_NAME(elem), Array)) ;
170 BOOST_PP_SEQ_FOR_EACH(VT_ARRAY_TYPEDEF, ~, VT_SCALAR_VALUE_TYPES)
174 #define VT_ARRAY_TYPE_TUPLE(r, unused, elem) \
175 (( BOOST_PP_CAT(Vt, BOOST_PP_CAT(VT_TYPE_NAME(elem), Array)) , \
176 BOOST_PP_CAT(VT_TYPE_NAME(elem), Array) ))
177 #define VT_ARRAY_VALUE_TYPES \
178 BOOST_PP_SEQ_FOR_EACH(VT_ARRAY_TYPE_TUPLE, ~, VT_SCALAR_VALUE_TYPES)
180 #define VT_CLASS_VALUE_TYPES \
181 VT_ARRAY_VALUE_TYPES VT_SCALAR_CLASS_VALUE_TYPES VT_NONARRAY_VALUE_TYPES
192 struct Vt_ShapeData {
193 unsigned int GetRank()
const {
195 otherDims[0] == 0 ? 1 :
196 otherDims[1] == 0 ? 2 :
197 otherDims[2] == 0 ? 3 : 4;
199 bool operator==(Vt_ShapeData
const &other)
const {
200 if (totalSize != other.totalSize)
202 unsigned int thisRank = GetRank(), otherRank = other.GetRank();
203 if (thisRank != otherRank)
205 return std::equal(otherDims, otherDims + GetRank() - 1,
208 bool operator!=(Vt_ShapeData
const &other)
const {
209 return !(*
this == other);
212 memset(
this, 0,
sizeof(*
this));
214 static const int NumOtherDims = 3;
216 unsigned int otherDims[NumOtherDims];
219 PXR_NAMESPACE_CLOSE_SCOPE
221 #endif // PXR_BASE_VT_TYPES_H
This header serves to simply bring in the half float datatype and provide a hash_value function...
Token for efficient comparison, assignment, and hashing of known strings.
Represents an arbitrary dimensional rectangular container class.
VT_API bool operator==(VtDictionary const &, VtDictionary const &)
Equality comparison.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...