23#ifndef vtkTypeTraits_h
24#define vtkTypeTraits_h
33#define VTK_TYPE_TRAITS(type, macro, isSigned, name, print, format) \
35 struct vtkTypeTraits<type> \
38 typedef type ValueType; \
43 VTK_TYPE_ID = VTK_##macro \
45 static int VTKTypeID() { return VTK_##macro; } \
48 static type Min() { return VTK_##macro##_MIN; } \
51 static type Max() { return VTK_##macro##_MAX; } \
54 static int IsSigned() { return isSigned; } \
57 typedef vtkType##name SizedType; \
60 static const char* SizedName() { return #name; } \
63 static const char* Name() { return #type; } \
66 typedef print PrintType; \
69 static const char* ParseFormat() { return format; } \
73#define VTK_TYPE_NAME_FLOAT float
74#define VTK_TYPE_NAME_DOUBLE double
75#define VTK_TYPE_SIZED_FLOAT FLOAT32
76#define VTK_TYPE_SIZED_DOUBLE FLOAT64
82#define VTK_TYPE_NAME_CHAR char
83#if VTK_TYPE_CHAR_IS_SIGNED
84#define VTK_TYPE_SIZED_CHAR INT8
87#define VTK_TYPE_SIZED_CHAR UINT8
90#define VTK_TYPE_NAME_SIGNED_CHAR signed char
91#define VTK_TYPE_NAME_UNSIGNED_CHAR unsigned char
92#define VTK_TYPE_SIZED_SIGNED_CHAR INT8
93#define VTK_TYPE_SIZED_UNSIGNED_CHAR UINT8
98#define VTK_TYPE_NAME_SHORT short
99#define VTK_TYPE_NAME_UNSIGNED_SHORT unsigned short
100#define VTK_TYPE_SIZED_SHORT INT16
101#define VTK_TYPE_SIZED_UNSIGNED_SHORT UINT16
106#define VTK_TYPE_NAME_INT int
107#define VTK_TYPE_NAME_UNSIGNED_INT unsigned int
108#define VTK_TYPE_SIZED_INT INT32
109#define VTK_TYPE_SIZED_UNSIGNED_INT UINT32
114#define VTK_TYPE_NAME_LONG long
115#define VTK_TYPE_NAME_UNSIGNED_LONG unsigned long
116#if VTK_SIZEOF_LONG == 4
117#define VTK_TYPE_SIZED_LONG INT32
118#define VTK_TYPE_SIZED_UNSIGNED_LONG UINT32
120VTK_TYPE_TRAITS(
unsigned long, UNSIGNED_LONG, 0, UInt32,
unsigned long,
"%lu");
121#elif VTK_SIZEOF_LONG == 8
122#define VTK_TYPE_SIZED_LONG INT64
123#define VTK_TYPE_SIZED_UNSIGNED_LONG UINT64
125VTK_TYPE_TRAITS(
unsigned long, UNSIGNED_LONG, 0, UInt64,
unsigned long,
"%lu");
127#error "Type long is not 4 or 8 bytes in size."
131#define VTK_TYPE_NAME_LONG_LONG long long
132#define VTK_TYPE_NAME_UNSIGNED_LONG_LONG unsigned long long
133#if VTK_SIZEOF_LONG_LONG == 8
134#define VTK_TYPE_SIZED_LONG_LONG INT64
135#define VTK_TYPE_SIZED_UNSIGNED_LONG_LONG UINT64
136#define VTK_TYPE_LONG_LONG_FORMAT "%ll"
137VTK_TYPE_TRAITS(
long long, LONG_LONG, 1, Int64,
long long, VTK_TYPE_LONG_LONG_FORMAT
"d");
138VTK_TYPE_TRAITS(
unsigned long long, UNSIGNED_LONG_LONG, 0, UInt64,
unsigned long long,
139 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
Template defining traits of native types used by VTK.
#define VTK_TYPE_TRAITS(type, macro, isSigned, name, print, format)