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_DUALQUATERNION_VALUE_TYPES \ 134 (( GfDualQuath, DualQuath )) \ 135 (( GfDualQuatf, DualQuatf )) \ 136 (( GfDualQuatd, DualQuatd )) 138 #define VT_NONARRAY_VALUE_TYPES \ 139 (( GfFrustum, Frustum)) \ 140 (( GfMultiInterval, MultiInterval)) 143 #define VT_TYPE(elem) \ 144 BOOST_PP_TUPLE_ELEM(2, 0, elem) 145 #define VT_TYPE_NAME(elem) \ 146 BOOST_PP_TUPLE_ELEM(2, 1, elem) 150 #define VT_BUILTIN_NUMERIC_VALUE_TYPES \ 151 VT_INTEGRAL_BUILTIN_VALUE_TYPES VT_FLOATING_POINT_BUILTIN_VALUE_TYPES 153 #define VT_BUILTIN_VALUE_TYPES \ 154 VT_BUILTIN_NUMERIC_VALUE_TYPES VT_STRING_VALUE_TYPES 156 #define VT_SCALAR_CLASS_VALUE_TYPES \ 158 VT_MATRIX_VALUE_TYPES \ 159 VT_RANGE_VALUE_TYPES \ 160 VT_QUATERNION_VALUE_TYPES \ 161 VT_DUALQUATERNION_VALUE_TYPES 163 #define VT_SCALAR_VALUE_TYPES \ 164 VT_SCALAR_CLASS_VALUE_TYPES VT_BUILTIN_VALUE_TYPES 172 template<
typename T>
class VtArray;
173 #define VT_ARRAY_TYPEDEF(r, unused, elem) \ 174 typedef VtArray< VT_TYPE(elem) > \ 175 BOOST_PP_CAT(Vt, BOOST_PP_CAT(VT_TYPE_NAME(elem), Array)) ; 176 BOOST_PP_SEQ_FOR_EACH(VT_ARRAY_TYPEDEF, ~, VT_SCALAR_VALUE_TYPES)
180 #define VT_ARRAY_TYPE_TUPLE(r, unused, elem) \ 181 (( BOOST_PP_CAT(Vt, BOOST_PP_CAT(VT_TYPE_NAME(elem), Array)) , \ 182 BOOST_PP_CAT(VT_TYPE_NAME(elem), Array) )) 183 #define VT_ARRAY_VALUE_TYPES \ 184 BOOST_PP_SEQ_FOR_EACH(VT_ARRAY_TYPE_TUPLE, ~, VT_SCALAR_VALUE_TYPES) 186 #define VT_CLASS_VALUE_TYPES \ 187 VT_ARRAY_VALUE_TYPES VT_SCALAR_CLASS_VALUE_TYPES VT_NONARRAY_VALUE_TYPES 198 struct Vt_ShapeData {
199 unsigned int GetRank()
const {
201 otherDims[0] == 0 ? 1 :
202 otherDims[1] == 0 ? 2 :
203 otherDims[2] == 0 ? 3 : 4;
205 bool operator==(Vt_ShapeData
const &other)
const {
206 if (totalSize != other.totalSize)
208 unsigned int thisRank = GetRank(), otherRank = other.GetRank();
209 if (thisRank != otherRank)
211 return std::equal(otherDims, otherDims + GetRank() - 1,
214 bool operator!=(Vt_ShapeData
const &other)
const {
215 return !(*
this == other);
218 memset(
this, 0,
sizeof(*
this));
220 static const int NumOtherDims = 3;
222 unsigned int otherDims[NumOtherDims];
225 PXR_NAMESPACE_CLOSE_SCOPE
227 #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...