26 #ifndef vtkTypeTraits_h 27 #define vtkTypeTraits_h 35 #define VTK_TYPE_TRAITS(type, macro, isSigned, name, print, format) \ 36 template <> struct vtkTypeTraits< type > \ 39 typedef type ValueType; \ 42 enum { VTK_TYPE_ID = VTK_##macro }; \ 43 static int VTKTypeID() { return VTK_##macro; } \ 46 static type Min() { return VTK_##macro##_MIN; } \ 49 static type Max() { return VTK_##macro##_MAX; } \ 52 static int IsSigned() { return isSigned; } \ 55 typedef vtkType##name SizedType; \ 58 static const char* SizedName() { return #name; } \ 61 static const char* Name() { return #type; } \ 64 typedef print PrintType; \ 67 static const char* ParseFormat() { return format; } \ 71 #define VTK_TYPE_NAME_FLOAT float 72 #define VTK_TYPE_NAME_DOUBLE double 73 #define VTK_TYPE_SIZED_FLOAT FLOAT32 74 #define VTK_TYPE_SIZED_DOUBLE FLOAT64 80 #define VTK_TYPE_NAME_CHAR char 81 #if VTK_TYPE_CHAR_IS_SIGNED 82 # define VTK_TYPE_SIZED_CHAR INT8 85 # define VTK_TYPE_SIZED_CHAR UINT8 88 #define VTK_TYPE_NAME_SIGNED_CHAR signed char 89 #define VTK_TYPE_NAME_UNSIGNED_CHAR unsigned char 90 #define VTK_TYPE_SIZED_SIGNED_CHAR INT8 91 #define VTK_TYPE_SIZED_UNSIGNED_CHAR UINT8 93 VTK_TYPE_TRAITS(
unsigned char, UNSIGNED_CHAR, 0, UInt8,
unsigned short,
"%hu");
96 #define VTK_TYPE_NAME_SHORT short 97 #define VTK_TYPE_NAME_UNSIGNED_SHORT unsigned short 98 #define VTK_TYPE_SIZED_SHORT INT16 99 #define VTK_TYPE_SIZED_UNSIGNED_SHORT UINT16 101 VTK_TYPE_TRAITS(
unsigned short, UNSIGNED_SHORT, 0, UInt16,
unsigned short,
105 #define VTK_TYPE_NAME_INT int 106 #define VTK_TYPE_NAME_UNSIGNED_INT unsigned int 107 #define VTK_TYPE_SIZED_INT INT32 108 #define VTK_TYPE_SIZED_UNSIGNED_INT UINT32 110 VTK_TYPE_TRAITS(
unsigned int, UNSIGNED_INT, 0, UInt32,
unsigned int,
"%u");
113 #define VTK_TYPE_NAME_LONG long 114 #define VTK_TYPE_NAME_UNSIGNED_LONG unsigned long 115 #if VTK_SIZEOF_LONG == 4 116 # define VTK_TYPE_SIZED_LONG INT32 117 # define VTK_TYPE_SIZED_UNSIGNED_LONG UINT32 119 VTK_TYPE_TRAITS(
unsigned long, UNSIGNED_LONG, 0, UInt32,
unsigned long,
"%lu");
120 #elif VTK_SIZEOF_LONG == 8 121 # define VTK_TYPE_SIZED_LONG INT64 122 # define VTK_TYPE_SIZED_UNSIGNED_LONG UINT64 124 VTK_TYPE_TRAITS(
unsigned long, UNSIGNED_LONG, 0, UInt64,
unsigned long,
"%lu");
126 # error "Type long is not 4 or 8 bytes in size." 130 #define VTK_TYPE_NAME_LONG_LONG long long 131 #define VTK_TYPE_NAME_UNSIGNED_LONG_LONG unsigned long long 132 #if VTK_SIZEOF_LONG_LONG == 8 133 # define VTK_TYPE_SIZED_LONG_LONG INT64 134 # define VTK_TYPE_SIZED_UNSIGNED_LONG_LONG UINT64 135 # define VTK_TYPE_LONG_LONG_FORMAT "%ll" 137 VTK_TYPE_LONG_LONG_FORMAT
"d");
139 unsigned long long, VTK_TYPE_LONG_LONG_FORMAT
"u");
140 # undef VTK_TYPE_LONG_LONG_FORMAT 142 # error "Type long long is not 8 bytes in size." 147 #define VTK_TYPE_NAME_ID_TYPE vtkIdType 148 #if defined(VTK_USE_64BIT_IDS) 149 # define VTK_TYPE_SIZED_ID_TYPE INT64 151 # define VTK_TYPE_SIZED_ID_TYPE INT32 154 #undef VTK_TYPE_TRAITS
#define VTK_TYPE_TRAITS(type, macro, isSigned, name, print, format)
Template defining traits of native types used by VTK.