VTK
vtkType.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkType.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 #ifndef vtkType_h
16 #define vtkType_h
17 
18 #include "vtkConfigure.h"
19 
20 /*--------------------------------------------------------------------------*/
21 /* Define a unique integer identifier for each native scalar type. */
22 
23 /* These types are returned by GetDataType to indicate pixel type. */
24 #define VTK_VOID 0
25 #define VTK_BIT 1
26 #define VTK_CHAR 2
27 #define VTK_SIGNED_CHAR 15
28 #define VTK_UNSIGNED_CHAR 3
29 #define VTK_SHORT 4
30 #define VTK_UNSIGNED_SHORT 5
31 #define VTK_INT 6
32 #define VTK_UNSIGNED_INT 7
33 #define VTK_LONG 8
34 #define VTK_UNSIGNED_LONG 9
35 #define VTK_FLOAT 10
36 #define VTK_DOUBLE 11
37 #define VTK_ID_TYPE 12
38 
39 /* These types are not currently supported by GetDataType, but are for
40  completeness. */
41 #define VTK_STRING 13
42 #define VTK_OPAQUE 14
43 
44 /* These types are enabled if VTK_TYPE_USE_LONG_LONG is defined. */
45 #define VTK_LONG_LONG 16
46 #define VTK_UNSIGNED_LONG_LONG 17
47 
48 /* This type is enabled if VTK_TYPE_USE___INT64 is defined. */
49 #define VTK___INT64 18
50 
51 /* This type is enabled if VTK_TYPE_USE___INT64 and
52  VTK_TYPE_CONVERT_UI64_TO_DOUBLE are both defined. */
53 #define VTK_UNSIGNED___INT64 19
54 
55 /* These types are required by vtkVariant and vtkVariantArray */
56 #define VTK_VARIANT 20
57 #define VTK_OBJECT 21
58 
59 /* Storage for Unicode strings */
60 #define VTK_UNICODE_STRING 22
61 
62 /*--------------------------------------------------------------------------*/
63 /* Define a unique integer identifier for each vtkDataObject type. */
64 /* When adding a new data type here, make sure to update */
65 /* vtkDataObjectTypes as well. */
66 #define VTK_POLY_DATA 0
67 #define VTK_STRUCTURED_POINTS 1
68 #define VTK_STRUCTURED_GRID 2
69 #define VTK_RECTILINEAR_GRID 3
70 #define VTK_UNSTRUCTURED_GRID 4
71 #define VTK_PIECEWISE_FUNCTION 5
72 #define VTK_IMAGE_DATA 6
73 #define VTK_DATA_OBJECT 7
74 #define VTK_DATA_SET 8
75 #define VTK_POINT_SET 9
76 #define VTK_UNIFORM_GRID 10
77 #define VTK_COMPOSITE_DATA_SET 11
78 #define VTK_MULTIGROUP_DATA_SET 12
79 #define VTK_MULTIBLOCK_DATA_SET 13
80 #define VTK_HIERARCHICAL_DATA_SET 14
81 #define VTK_HIERARCHICAL_BOX_DATA_SET 15
82 #define VTK_GENERIC_DATA_SET 16
83 #define VTK_HYPER_OCTREE 17
84 #define VTK_TEMPORAL_DATA_SET 18
85 #define VTK_TABLE 19
86 #define VTK_GRAPH 20
87 #define VTK_TREE 21
88 #define VTK_SELECTION 22
89 #define VTK_DIRECTED_GRAPH 23
90 #define VTK_UNDIRECTED_GRAPH 24
91 #define VTK_MULTIPIECE_DATA_SET 25
92 #define VTK_DIRECTED_ACYCLIC_GRAPH 26
93 #define VTK_ARRAY_DATA 27
94 #define VTK_REEB_GRAPH 28
95 #define VTK_UNIFORM_GRID_AMR 29
96 #define VTK_NON_OVERLAPPING_AMR 30
97 #define VTK_OVERLAPPING_AMR 31
98 #define VTK_HYPER_TREE_GRID 32
99 #define VTK_MOLECULE 33
100 #define VTK_PISTON_DATA_OBJECT 34
101 #define VTK_PATH 35
102 #define VTK_UNSTRUCTURED_GRID_BASE 36
103 
104 /*--------------------------------------------------------------------------*/
105 /* Define a casting macro for use by the constants below. */
106 #if defined(__cplusplus)
107 # define VTK_TYPE_CAST(T, V) static_cast< T >(V)
108 #else
109 # define VTK_TYPE_CAST(T, V) ((T)(V))
110 #endif
111 
112 /*--------------------------------------------------------------------------*/
113 /* Define min/max constants for each type. */
114 #define VTK_BIT_MIN 0
115 #define VTK_BIT_MAX 1
116 #if VTK_TYPE_CHAR_IS_SIGNED
117 # define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0x80)
118 # define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0x7f)
119 #else
120 # define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0u)
121 # define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0xffu)
122 #endif
123 #define VTK_SIGNED_CHAR_MIN VTK_TYPE_CAST(signed char, 0x80)
124 #define VTK_SIGNED_CHAR_MAX VTK_TYPE_CAST(signed char, 0x7f)
125 #define VTK_UNSIGNED_CHAR_MIN VTK_TYPE_CAST(unsigned char, 0u)
126 #define VTK_UNSIGNED_CHAR_MAX VTK_TYPE_CAST(unsigned char, 0xffu)
127 #define VTK_SHORT_MIN VTK_TYPE_CAST(short, 0x8000)
128 #define VTK_SHORT_MAX VTK_TYPE_CAST(short, 0x7fff)
129 #define VTK_UNSIGNED_SHORT_MIN VTK_TYPE_CAST(unsigned short, 0u)
130 #define VTK_UNSIGNED_SHORT_MAX VTK_TYPE_CAST(unsigned short, 0xffffu)
131 #define VTK_INT_MIN VTK_TYPE_CAST(int, ~(~0u >> 1))
132 #define VTK_INT_MAX VTK_TYPE_CAST(int, ~0u >> 1)
133 #define VTK_UNSIGNED_INT_MIN VTK_TYPE_CAST(unsigned int, 0)
134 #define VTK_UNSIGNED_INT_MAX VTK_TYPE_CAST(unsigned int, ~0u)
135 #define VTK_LONG_MIN VTK_TYPE_CAST(long, ~(~0ul >> 1))
136 #define VTK_LONG_MAX VTK_TYPE_CAST(long, ~0ul >> 1)
137 #define VTK_UNSIGNED_LONG_MIN VTK_TYPE_CAST(unsigned long, 0ul)
138 #define VTK_UNSIGNED_LONG_MAX VTK_TYPE_CAST(unsigned long, ~0ul)
139 #define VTK_FLOAT_MIN VTK_TYPE_CAST(float, -1.0e+38f)
140 #define VTK_FLOAT_MAX VTK_TYPE_CAST(float, 1.0e+38f)
141 #define VTK_DOUBLE_MIN VTK_TYPE_CAST(double, -1.0e+299)
142 #define VTK_DOUBLE_MAX VTK_TYPE_CAST(double, 1.0e+299)
143 #if defined(VTK_SIZEOF_LONG_LONG)
144 # define VTK_LONG_LONG_MIN VTK_TYPE_CAST(long long, ~(~0ull >> 1))
145 # define VTK_LONG_LONG_MAX VTK_TYPE_CAST(long long, ~0ull >> 1)
146 # define VTK_UNSIGNED_LONG_LONG_MIN VTK_TYPE_CAST(unsigned long long, 0ull)
147 # define VTK_UNSIGNED_LONG_LONG_MAX VTK_TYPE_CAST(unsigned long long, ~0ull)
148 #endif
149 #if defined(VTK_SIZEOF___INT64)
150 # if defined(VTK_TYPE_SAME_LONG_AND___INT64)
151 # define VTK___INT64_MIN VTK_TYPE_CAST(__int64, ~(~0ul >> 1))
152 # define VTK___INT64_MAX VTK_TYPE_CAST(__int64, ~0ul >> 1)
153 # define VTK_UNSIGNED___INT64_MIN VTK_TYPE_CAST(unsigned __int64, 0ul)
154 # define VTK_UNSIGNED___INT64_MAX VTK_TYPE_CAST(unsigned __int64, ~0ul)
155 # elif defined(VTK_TYPE_SAME_LONG_LONG_AND___INT64)
156 # define VTK___INT64_MIN VTK_TYPE_CAST(__int64, ~(~0ull >> 1))
157 # define VTK___INT64_MAX VTK_TYPE_CAST(__int64, ~0ull >> 1)
158 # define VTK_UNSIGNED___INT64_MIN VTK_TYPE_CAST(unsigned __int64, 0ull)
159 # define VTK_UNSIGNED___INT64_MAX VTK_TYPE_CAST(unsigned __int64, ~0ull)
160 # else
161 # define VTK___INT64_MIN VTK_TYPE_CAST(__int64, ~(~0ui64 >> 1))
162 # define VTK___INT64_MAX VTK_TYPE_CAST(__int64, ~0ui64 >> 1)
163 # define VTK_UNSIGNED___INT64_MIN VTK_TYPE_CAST(unsigned __int64, 0ui64)
164 # define VTK_UNSIGNED___INT64_MAX VTK_TYPE_CAST(unsigned __int64, ~0ui64)
165 # endif
166 #endif
167 
168 /*--------------------------------------------------------------------------*/
169 /* Define named types and constants corresponding to specific integer
170  and floating-point sizes and signedness. */
171 
172 /* Select an 8-bit integer type. */
173 #if VTK_SIZEOF_CHAR == 1
174 typedef unsigned char vtkTypeUInt8;
175 typedef signed char vtkTypeInt8;
176 # define VTK_TYPE_UINT8 VTK_UNSIGNED_CHAR
177 # if VTK_TYPE_CHAR_IS_SIGNED
178 # define VTK_TYPE_INT8 VTK_CHAR
179 # else
180 # define VTK_TYPE_INT8 VTK_SIGNED_CHAR
181 # endif
182 #else
183 # error "No native data type can represent an 8-bit integer."
184 #endif
185 
186 /* Select a 16-bit integer type. */
187 #if VTK_SIZEOF_SHORT == 2
188 typedef unsigned short vtkTypeUInt16;
189 typedef signed short vtkTypeInt16;
190 # define VTK_TYPE_UINT16 VTK_UNSIGNED_SHORT
191 # define VTK_TYPE_INT16 VTK_SHORT
192 #elif VTK_SIZEOF_INT == 2
193 typedef unsigned int vtkTypeUInt16;
194 typedef signed int vtkTypeInt16;
195 # define VTK_TYPE_UINT16 VTK_UNSIGNED_INT
196 # define VTK_TYPE_INT16 VTK_INT
197 #else
198 # error "No native data type can represent a 16-bit integer."
199 #endif
200 
201 /* Select a 32-bit integer type. */
202 #if VTK_SIZEOF_INT == 4
203 typedef unsigned int vtkTypeUInt32;
204 typedef signed int vtkTypeInt32;
205 # define VTK_TYPE_UINT32 VTK_UNSIGNED_INT
206 # define VTK_TYPE_INT32 VTK_INT
207 #elif VTK_SIZEOF_LONG == 4
208 typedef unsigned long vtkTypeUInt32;
209 typedef signed long vtkTypeInt32;
210 # define VTK_TYPE_UINT32 VTK_UNSIGNED_LONG
211 # define VTK_TYPE_INT32 VTK_LONG
212 #else
213 # error "No native data type can represent a 32-bit integer."
214 #endif
215 
216 /* Select a 64-bit integer type. */
217 #if defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8
218 typedef unsigned long long vtkTypeUInt64;
219 typedef signed long long vtkTypeInt64;
220 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG_LONG
221 # define VTK_TYPE_INT64 VTK_LONG_LONG
222 #elif VTK_SIZEOF_LONG == 8
223 typedef unsigned long vtkTypeUInt64;
224 typedef signed long vtkTypeInt64;
225 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG
226 # define VTK_TYPE_INT64 VTK_LONG
227 #elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8
228 typedef unsigned __int64 vtkTypeUInt64;
229 typedef signed __int64 vtkTypeInt64;
230 # define VTK_TYPE_UINT64 VTK_UNSIGNED___INT64
231 # define VTK_TYPE_INT64 VTK___INT64
232 #else
233 # error "No native data type can represent a 64-bit integer."
234 #endif
235 
236 /* Select a 32-bit floating point type. */
237 #if VTK_SIZEOF_FLOAT == 4
238 typedef float vtkTypeFloat32;
239 # define VTK_TYPE_FLOAT32 VTK_FLOAT
240 #else
241 # error "No native data type can represent a 32-bit floating point value."
242 #endif
243 
244 /* Select a 64-bit floating point type. */
245 #if VTK_SIZEOF_DOUBLE == 8
246 typedef double vtkTypeFloat64;
247 # define VTK_TYPE_FLOAT64 VTK_DOUBLE
248 #else
249 # error "No native data type can represent a 64-bit floating point value."
250 #endif
251 
252 /*--------------------------------------------------------------------------*/
253 /* Choose an implementation for vtkIdType. */
254 #define VTK_HAS_ID_TYPE
255 #ifdef VTK_USE_64BIT_IDS
256 # if defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8
257 typedef long long vtkIdType;
258 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG_LONG
259 # define VTK_ID_MIN VTK_LONG_LONG_MIN
260 # define VTK_ID_MAX VTK_LONG_LONG_MAX
261 # elif defined(VTK_SIZEOF_LONG) && VTK_SIZEOF_LONG == 8
262 typedef long vtkIdType;
263 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG
264 # define VTK_ID_MIN VTK_LONG_MIN
265 # define VTK_ID_MAX VTK_LONG_MAX
266 # elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8
267 typedef __int64 vtkIdType;
268 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF___INT64
269 # define VTK_ID_MIN VTK___INT64_MIN
270 # define VTK_ID_MAX VTK___INT64_MAX
271 # else
272 # error "VTK_USE_64BIT_IDS is ON but no 64-bit integer type is available."
273 # endif
274 #else
275 typedef int vtkIdType;
276 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_INT
277 # define VTK_ID_MIN VTK_INT_MIN
278 # define VTK_ID_MAX VTK_INT_MAX
279 #endif
280 
281 #endif
282 // VTK-HeaderTest-Exclude: vtkType.h
int vtkIdType
Definition: vtkType.h:275