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 /* Define compatibility names for these constants. */
169 #if !defined(VTK_LEGACY_REMOVE)
170 # define VTK_LARGE_INTEGER VTK_INT_MAX
171 # define VTK_LARGE_FLOAT VTK_FLOAT_MAX
172 #endif
173 
174 /*--------------------------------------------------------------------------*/
175 /* Define named types and constants corresponding to specific integer
176  and floating-point sizes and signedness. */
177 
178 /* Select an 8-bit integer type. */
179 #if VTK_SIZEOF_CHAR == 1
180 typedef unsigned char vtkTypeUInt8;
181 typedef signed char vtkTypeInt8;
182 # define VTK_TYPE_UINT8 VTK_UNSIGNED_CHAR
183 # if VTK_TYPE_CHAR_IS_SIGNED
184 # define VTK_TYPE_INT8 VTK_CHAR
185 # else
186 # define VTK_TYPE_INT8 VTK_SIGNED_CHAR
187 # endif
188 #else
189 # error "No native data type can represent an 8-bit integer."
190 #endif
191 
192 /* Select a 16-bit integer type. */
193 #if VTK_SIZEOF_SHORT == 2
194 typedef unsigned short vtkTypeUInt16;
195 typedef signed short vtkTypeInt16;
196 # define VTK_TYPE_UINT16 VTK_UNSIGNED_SHORT
197 # define VTK_TYPE_INT16 VTK_SHORT
198 #elif VTK_SIZEOF_INT == 2
199 typedef unsigned int vtkTypeUInt16;
200 typedef signed int vtkTypeInt16;
201 # define VTK_TYPE_UINT16 VTK_UNSIGNED_INT
202 # define VTK_TYPE_INT16 VTK_INT
203 #else
204 # error "No native data type can represent a 16-bit integer."
205 #endif
206 
207 /* Select a 32-bit integer type. */
208 #if VTK_SIZEOF_INT == 4
209 typedef unsigned int vtkTypeUInt32;
210 typedef signed int vtkTypeInt32;
211 # define VTK_TYPE_UINT32 VTK_UNSIGNED_INT
212 # define VTK_TYPE_INT32 VTK_INT
213 #elif VTK_SIZEOF_LONG == 4
214 typedef unsigned long vtkTypeUInt32;
215 typedef signed long vtkTypeInt32;
216 # define VTK_TYPE_UINT32 VTK_UNSIGNED_LONG
217 # define VTK_TYPE_INT32 VTK_LONG
218 #else
219 # error "No native data type can represent a 32-bit integer."
220 #endif
221 
222 /* Select a 64-bit integer type. */
223 #if defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8
224 typedef unsigned long long vtkTypeUInt64;
225 typedef signed long long vtkTypeInt64;
226 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG_LONG
227 # define VTK_TYPE_INT64 VTK_LONG_LONG
228 #elif VTK_SIZEOF_LONG == 8
229 typedef unsigned long vtkTypeUInt64;
230 typedef signed long vtkTypeInt64;
231 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG
232 # define VTK_TYPE_INT64 VTK_LONG
233 #elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8
234 typedef unsigned __int64 vtkTypeUInt64;
235 typedef signed __int64 vtkTypeInt64;
236 # define VTK_TYPE_UINT64 VTK_UNSIGNED___INT64
237 # define VTK_TYPE_INT64 VTK___INT64
238 #else
239 # error "No native data type can represent a 64-bit integer."
240 #endif
241 
242 /* Select a 32-bit floating point type. */
243 #if VTK_SIZEOF_FLOAT == 4
244 typedef float vtkTypeFloat32;
245 # define VTK_TYPE_FLOAT32 VTK_FLOAT
246 #else
247 # error "No native data type can represent a 32-bit floating point value."
248 #endif
249 
250 /* Select a 64-bit floating point type. */
251 #if VTK_SIZEOF_DOUBLE == 8
252 typedef double vtkTypeFloat64;
253 # define VTK_TYPE_FLOAT64 VTK_DOUBLE
254 #else
255 # error "No native data type can represent a 64-bit floating point value."
256 #endif
257 
258 /*--------------------------------------------------------------------------*/
259 /* Choose an implementation for vtkIdType. */
260 #define VTK_HAS_ID_TYPE
261 #ifdef VTK_USE_64BIT_IDS
262 # if defined(VTK_SIZEOF_LONG) && VTK_SIZEOF_LONG == 8 && 0
263 typedef long vtkIdType;
264 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG
265 # define VTK_ID_MIN VTK_LONG_MIN
266 # define VTK_ID_MAX VTK_LONG_MAX
267 # elif defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8
268 typedef long long vtkIdType;
269 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG_LONG
270 # define VTK_ID_MIN VTK_LONG_LONG_MIN
271 # define VTK_ID_MAX VTK_LONG_LONG_MAX
272 # elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8
273 typedef __int64 vtkIdType;
274 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF___INT64
275 # define VTK_ID_MIN VTK___INT64_MIN
276 # define VTK_ID_MAX VTK___INT64_MAX
277 # else
278 # error "VTK_USE_64BIT_IDS is ON but no 64-bit integer type is available."
279 # endif
280 #else
281 typedef int vtkIdType;
282 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_INT
283 # define VTK_ID_MIN VTK_INT_MIN
284 # define VTK_ID_MAX VTK_INT_MAX
285 #endif
286 
287 /*--------------------------------------------------------------------------*/
288 /* Provide deprecated pre-VTK6 constant. */
289 #if !defined(VTK_LEGACY_REMOVE)
290 # define VTK_LARGE_ID VTK_ID_MAX
291 #endif
292 
293 /*--------------------------------------------------------------------------*/
294 /* Define the type of floating point interface used for old and new
295  versions of VTK. VTK 4.2 and older use float and VTK 4.4 and newer
296  use double for most of the API calls. */
297 #if !defined(VTK_LEGACY_REMOVE)
298 # define vtkFloatingPointType double
299 #endif
300 
301 #endif
302 // VTK-HeaderTest-Exclude: vtkType.h
int vtkIdType
Definition: vtkType.h:281