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 
95 /*--------------------------------------------------------------------------*/
96 /* Define a casting macro for use by the constants below. */
97 #if defined(__cplusplus)
98 # define VTK_TYPE_CAST(T, V) static_cast< T >(V)
99 #else
100 # define VTK_TYPE_CAST(T, V) ((T)(V))
101 #endif
102 
103 /*--------------------------------------------------------------------------*/
104 /* Define min/max constants for each type. */
105 #define VTK_BIT_MIN 0
106 #define VTK_BIT_MAX 1
107 #if VTK_TYPE_CHAR_IS_SIGNED
108 # define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0x80)
109 # define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0x7f)
110 #else
111 # define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0u)
112 # define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0xffu)
113 #endif
114 #define VTK_SIGNED_CHAR_MIN VTK_TYPE_CAST(signed char, 0x80)
115 #define VTK_SIGNED_CHAR_MAX VTK_TYPE_CAST(signed char, 0x7f)
116 #define VTK_UNSIGNED_CHAR_MIN VTK_TYPE_CAST(unsigned char, 0u)
117 #define VTK_UNSIGNED_CHAR_MAX VTK_TYPE_CAST(unsigned char, 0xffu)
118 #define VTK_SHORT_MIN VTK_TYPE_CAST(short, 0x8000)
119 #define VTK_SHORT_MAX VTK_TYPE_CAST(short, 0x7fff)
120 #define VTK_UNSIGNED_SHORT_MIN VTK_TYPE_CAST(unsigned short, 0u)
121 #define VTK_UNSIGNED_SHORT_MAX VTK_TYPE_CAST(unsigned short, 0xffffu)
122 #define VTK_INT_MIN VTK_TYPE_CAST(int, ~(~0u >> 1))
123 #define VTK_INT_MAX VTK_TYPE_CAST(int, ~0u >> 1)
124 #define VTK_UNSIGNED_INT_MIN VTK_TYPE_CAST(unsigned int, 0)
125 #define VTK_UNSIGNED_INT_MAX VTK_TYPE_CAST(unsigned int, ~0u)
126 #define VTK_LONG_MIN VTK_TYPE_CAST(long, ~(~0ul >> 1))
127 #define VTK_LONG_MAX VTK_TYPE_CAST(long, ~0ul >> 1)
128 #define VTK_UNSIGNED_LONG_MIN VTK_TYPE_CAST(unsigned long, 0ul)
129 #define VTK_UNSIGNED_LONG_MAX VTK_TYPE_CAST(unsigned long, ~0ul)
130 #define VTK_FLOAT_MIN VTK_TYPE_CAST(float, -1.0e+38f)
131 #define VTK_FLOAT_MAX VTK_TYPE_CAST(float, 1.0e+38f)
132 #define VTK_DOUBLE_MIN VTK_TYPE_CAST(double, -1.0e+299)
133 #define VTK_DOUBLE_MAX VTK_TYPE_CAST(double, 1.0e+299)
134 #if defined(VTK_SIZEOF_LONG_LONG)
135 # define VTK_LONG_LONG_MIN VTK_TYPE_CAST(long long, ~(~0ull >> 1))
136 # define VTK_LONG_LONG_MAX VTK_TYPE_CAST(long long, ~0ull >> 1)
137 # define VTK_UNSIGNED_LONG_LONG_MIN VTK_TYPE_CAST(unsigned long long, 0ull)
138 # define VTK_UNSIGNED_LONG_LONG_MAX VTK_TYPE_CAST(unsigned long long, ~0ull)
139 #endif
140 #if defined(VTK_SIZEOF___INT64)
141 # define VTK___INT64_MIN VTK_TYPE_CAST(__int64, ~(~0ui64 >> 1))
142 # define VTK___INT64_MAX VTK_TYPE_CAST(__int64, ~0ui64 >> 1)
143 # define VTK_UNSIGNED___INT64_MIN VTK_TYPE_CAST(unsigned __int64, 0ui64)
144 # define VTK_UNSIGNED___INT64_MAX VTK_TYPE_CAST(unsigned __int64, ~0ui64)
145 #endif
146 
147 /* Define compatibility names for these constants. */
148 #define VTK_LARGE_INTEGER VTK_INT_MAX
149 #define VTK_LARGE_FLOAT VTK_FLOAT_MAX
150 
151 /*--------------------------------------------------------------------------*/
152 /* Define named types and constants corresponding to specific integer
153  and floating-point sizes and signedness. */
154 
155 /* Select an 8-bit integer type. */
156 #if VTK_SIZEOF_CHAR == 1
157 typedef unsigned char vtkTypeUInt8;
158 typedef signed char vtkTypeInt8;
159 # define VTK_TYPE_UINT8 VTK_UNSIGNED_CHAR
160 # if VTK_TYPE_CHAR_IS_SIGNED
161 # define VTK_TYPE_INT8 VTK_CHAR
162 # else
163 # define VTK_TYPE_INT8 VTK_SIGNED_CHAR
164 # endif
165 #else
166 # error "No native data type can represent an 8-bit integer."
167 #endif
168 
169 /* Select a 16-bit integer type. */
170 #if VTK_SIZEOF_SHORT == 2
171 typedef unsigned short vtkTypeUInt16;
172 typedef signed short vtkTypeInt16;
173 # define VTK_TYPE_UINT16 VTK_UNSIGNED_SHORT
174 # define VTK_TYPE_INT16 VTK_SHORT
175 #elif VTK_SIZEOF_INT == 2
176 typedef unsigned int vtkTypeUInt16;
177 typedef signed int vtkTypeInt16;
178 # define VTK_TYPE_UINT16 VTK_UNSIGNED_INT
179 # define VTK_TYPE_INT16 VTK_INT
180 #else
181 # error "No native data type can represent a 16-bit integer."
182 #endif
183 
184 /* Select a 32-bit integer type. */
185 #if VTK_SIZEOF_INT == 4
186 typedef unsigned int vtkTypeUInt32;
187 typedef signed int vtkTypeInt32;
188 # define VTK_TYPE_UINT32 VTK_UNSIGNED_INT
189 # define VTK_TYPE_INT32 VTK_INT
190 #elif VTK_SIZEOF_LONG == 4
191 typedef unsigned long vtkTypeUInt32;
192 typedef signed long vtkTypeInt32;
193 # define VTK_TYPE_UINT32 VTK_UNSIGNED_LONG
194 # define VTK_TYPE_INT32 VTK_LONG
195 #else
196 # error "No native data type can represent a 32-bit integer."
197 #endif
198 
199 /* Select a 64-bit integer type. */
200 #if defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8
201 typedef unsigned long long vtkTypeUInt64;
202 typedef signed long long vtkTypeInt64;
203 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG_LONG
204 # define VTK_TYPE_INT64 VTK_LONG_LONG
205 #elif VTK_SIZEOF_LONG == 8
206 typedef unsigned long vtkTypeUInt64;
207 typedef signed long vtkTypeInt64;
208 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG
209 # define VTK_TYPE_INT64 VTK_LONG
210 #elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8
211 typedef unsigned __int64 vtkTypeUInt64;
212 typedef signed __int64 vtkTypeInt64;
213 # define VTK_TYPE_UINT64 VTK_UNSIGNED___INT64
214 # define VTK_TYPE_INT64 VTK___INT64
215 #else
216 # error "No native data type can represent a 64-bit integer."
217 #endif
218 
219 /* Select a 32-bit floating point type. */
220 #if VTK_SIZEOF_FLOAT == 4
221 typedef float vtkTypeFloat32;
222 # define VTK_TYPE_FLOAT32 VTK_FLOAT
223 #else
224 # error "No native data type can represent a 32-bit floating point value."
225 #endif
226 
227 /* Select a 64-bit floating point type. */
228 #if VTK_SIZEOF_DOUBLE == 8
229 typedef double vtkTypeFloat64;
230 # define VTK_TYPE_FLOAT64 VTK_DOUBLE
231 #else
232 # error "No native data type can represent a 64-bit floating point value."
233 #endif
234 
235 /*--------------------------------------------------------------------------*/
236 /* Choose an implementation for vtkIdType. */
237 #define VTK_HAS_ID_TYPE
238 #ifdef VTK_USE_64BIT_IDS
239 # if defined(VTK_SIZEOF_LONG) && VTK_SIZEOF_LONG == 8 && 0
240 typedef long vtkIdType;
241 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG
242 # define VTK_LARGE_ID VTK_LONG_MAX
243 # elif defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8
244 typedef long long vtkIdType;
245 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG_LONG
246 # define VTK_LARGE_ID VTK_LONG_LONG_MAX
247 # elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8
248 typedef __int64 vtkIdType;
249 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF___INT64
250 # define VTK_LARGE_ID VTK___INT64_MAX
251 # else
252 # error "VTK_USE_64BIT_IDS is ON but no 64-bit integer type is available."
253 # endif
254 #else
255 typedef int vtkIdType;
256 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_INT
257 # define VTK_LARGE_ID VTK_INT_MAX
258 #endif
259 
260 /*--------------------------------------------------------------------------*/
261 /* Define the type of floating point interface used for old and new
262  versions of VTK. VTK 4.2 and older use float and VTK 4.4 and newer
263  use double for most of the API calls. */
264 #define vtkFloatingPointType vtkFloatingPointType
265 typedef double vtkFloatingPointType;
266 
267 #endif
int vtkIdType
Definition: vtkType.h:255
#define vtkFloatingPointType
Definition: vtkType.h:264