VTK
9.0.20210307
Common
Core
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 "
vtkCompiler.h
"
// for VTK_USE_EXTERN_TEMPLATE
19
#include "vtkLegacy.h"
// For VTK_LEGACY_REMOVE
20
#include "vtkOptions.h"
// for VTK_USE_64BIT_IDS and VTK_USE_64BIT_TIMESTAMPS
21
#include "vtk_kwiml.h"
22
23
#define VTK_SIZEOF_CHAR KWIML_ABI_SIZEOF_CHAR
24
#define VTK_SIZEOF_SHORT KWIML_ABI_SIZEOF_SHORT
25
#define VTK_SIZEOF_INT KWIML_ABI_SIZEOF_INT
26
#define VTK_SIZEOF_LONG KWIML_ABI_SIZEOF_LONG
27
#define VTK_SIZEOF_LONG_LONG KWIML_ABI_SIZEOF_LONG_LONG
28
#define VTK_SIZEOF_FLOAT KWIML_ABI_SIZEOF_FLOAT
29
#define VTK_SIZEOF_DOUBLE KWIML_ABI_SIZEOF_DOUBLE
30
#define VTK_SIZEOF_VOID_P KWIML_ABI_SIZEOF_DATA_PTR
31
32
/* Whether type "char" is signed (it may be signed or unsigned). */
33
#if defined(KWIML_ABI_CHAR_IS_SIGNED)
34
#define VTK_TYPE_CHAR_IS_SIGNED 1
35
#else
36
#define VTK_TYPE_CHAR_IS_SIGNED 0
37
#endif
38
39
/*--------------------------------------------------------------------------*/
40
/* Define a unique integer identifier for each native scalar type. */
41
42
/* These types are returned by GetDataType to indicate pixel type. */
43
#define VTK_VOID 0
44
#define VTK_BIT 1
45
#define VTK_CHAR 2
46
#define VTK_SIGNED_CHAR 15
47
#define VTK_UNSIGNED_CHAR 3
48
#define VTK_SHORT 4
49
#define VTK_UNSIGNED_SHORT 5
50
#define VTK_INT 6
51
#define VTK_UNSIGNED_INT 7
52
#define VTK_LONG 8
53
#define VTK_UNSIGNED_LONG 9
54
#define VTK_FLOAT 10
55
#define VTK_DOUBLE 11
56
#define VTK_ID_TYPE 12
57
58
/* These types are not currently supported by GetDataType, but are for
59
completeness. */
60
#define VTK_STRING 13
61
#define VTK_OPAQUE 14
62
63
#define VTK_LONG_LONG 16
64
#define VTK_UNSIGNED_LONG_LONG 17
65
66
/* These types are required by vtkVariant and vtkVariantArray */
67
#define VTK_VARIANT 20
68
#define VTK_OBJECT 21
69
70
/* Storage for Unicode strings */
71
#define VTK_UNICODE_STRING 22
72
73
/*--------------------------------------------------------------------------*/
74
/* Define a unique integer identifier for each vtkDataObject type. */
75
/* When adding a new data type here, make sure to update */
76
/* vtkDataObjectTypes as well. */
77
#define VTK_POLY_DATA 0
78
#define VTK_STRUCTURED_POINTS 1
79
#define VTK_STRUCTURED_GRID 2
80
#define VTK_RECTILINEAR_GRID 3
81
#define VTK_UNSTRUCTURED_GRID 4
82
#define VTK_PIECEWISE_FUNCTION 5
83
#define VTK_IMAGE_DATA 6
84
#define VTK_DATA_OBJECT 7
85
#define VTK_DATA_SET 8
86
#define VTK_POINT_SET 9
87
#define VTK_UNIFORM_GRID 10
88
#define VTK_COMPOSITE_DATA_SET 11
89
#define VTK_MULTIGROUP_DATA_SET 12
90
#define VTK_MULTIBLOCK_DATA_SET 13
91
#define VTK_HIERARCHICAL_DATA_SET 14
92
#define VTK_HIERARCHICAL_BOX_DATA_SET 15
93
#define VTK_GENERIC_DATA_SET 16
94
#define VTK_HYPER_OCTREE 17
95
#define VTK_TEMPORAL_DATA_SET 18
96
#define VTK_TABLE 19
97
#define VTK_GRAPH 20
98
#define VTK_TREE 21
99
#define VTK_SELECTION 22
100
#define VTK_DIRECTED_GRAPH 23
101
#define VTK_UNDIRECTED_GRAPH 24
102
#define VTK_MULTIPIECE_DATA_SET 25
103
#define VTK_DIRECTED_ACYCLIC_GRAPH 26
104
#define VTK_ARRAY_DATA 27
105
#define VTK_REEB_GRAPH 28
106
#define VTK_UNIFORM_GRID_AMR 29
107
#define VTK_NON_OVERLAPPING_AMR 30
108
#define VTK_OVERLAPPING_AMR 31
109
#define VTK_HYPER_TREE_GRID 32
110
#define VTK_MOLECULE 33
111
#define VTK_PISTON_DATA_OBJECT 34
112
#define VTK_PATH 35
113
#define VTK_UNSTRUCTURED_GRID_BASE 36
114
#define VTK_PARTITIONED_DATA_SET 37
115
#define VTK_PARTITIONED_DATA_SET_COLLECTION 38
116
#define VTK_UNIFORM_HYPER_TREE_GRID 39
117
#define VTK_EXPLICIT_STRUCTURED_GRID 40
118
#define VTK_DATA_OBJECT_TREE 41
119
#define VTK_ABSTRACT_ELECTRONIC_DATA 42
120
#define VTK_OPEN_QUBE_ELECTRONIC_DATA 43
121
#define VTK_ANNOTATION 44
122
#define VTK_ANNOTATION_LAYERS 45
123
#define VTK_BSP_CUTS 46
124
#define VTK_GEO_JSON_FEATURE 47
125
#define VTK_IMAGE_STENCIL_DATA 48
126
127
/*--------------------------------------------------------------------------*/
128
/* Define a casting macro for use by the constants below. */
129
#if defined(__cplusplus)
130
#define VTK_TYPE_CAST(T, V) static_cast<T>(V)
131
#else
132
#define VTK_TYPE_CAST(T, V) ((T)(V))
133
#endif
134
135
/*--------------------------------------------------------------------------*/
136
/* Define min/max constants for each type. */
137
#define VTK_BIT_MIN 0
138
#define VTK_BIT_MAX 1
139
#if VTK_TYPE_CHAR_IS_SIGNED
140
#define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0x80)
141
#define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0x7f)
142
#else
143
#define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0u)
144
#define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0xffu)
145
#endif
146
#define VTK_SIGNED_CHAR_MIN VTK_TYPE_CAST(signed char, 0x80)
147
#define VTK_SIGNED_CHAR_MAX VTK_TYPE_CAST(signed char, 0x7f)
148
#define VTK_UNSIGNED_CHAR_MIN VTK_TYPE_CAST(unsigned char, 0u)
149
#define VTK_UNSIGNED_CHAR_MAX VTK_TYPE_CAST(unsigned char, 0xffu)
150
#define VTK_SHORT_MIN VTK_TYPE_CAST(short, 0x8000)
151
#define VTK_SHORT_MAX VTK_TYPE_CAST(short, 0x7fff)
152
#define VTK_UNSIGNED_SHORT_MIN VTK_TYPE_CAST(unsigned short, 0u)
153
#define VTK_UNSIGNED_SHORT_MAX VTK_TYPE_CAST(unsigned short, 0xffffu)
154
#define VTK_INT_MIN VTK_TYPE_CAST(int, ~(~0u >> 1))
155
#define VTK_INT_MAX VTK_TYPE_CAST(int, ~0u >> 1)
156
#define VTK_UNSIGNED_INT_MIN VTK_TYPE_CAST(unsigned int, 0)
157
#define VTK_UNSIGNED_INT_MAX VTK_TYPE_CAST(unsigned int, ~0u)
158
#define VTK_LONG_MIN VTK_TYPE_CAST(long, ~(~0ul >> 1))
159
#define VTK_LONG_MAX VTK_TYPE_CAST(long, ~0ul >> 1)
160
#define VTK_UNSIGNED_LONG_MIN VTK_TYPE_CAST(unsigned long, 0ul)
161
#define VTK_UNSIGNED_LONG_MAX VTK_TYPE_CAST(unsigned long, ~0ul)
162
#define VTK_FLOAT_MIN VTK_TYPE_CAST(float, -1.0e+38f)
163
#define VTK_FLOAT_MAX VTK_TYPE_CAST(float, 1.0e+38f)
164
#define VTK_DOUBLE_MIN VTK_TYPE_CAST(double, -1.0e+299)
165
#define VTK_DOUBLE_MAX VTK_TYPE_CAST(double, 1.0e+299)
166
#define VTK_LONG_LONG_MIN VTK_TYPE_CAST(long long, ~(~0ull >> 1))
167
#define VTK_LONG_LONG_MAX VTK_TYPE_CAST(long long, ~0ull >> 1)
168
#define VTK_UNSIGNED_LONG_LONG_MIN VTK_TYPE_CAST(unsigned long long, 0ull)
169
#define VTK_UNSIGNED_LONG_LONG_MAX VTK_TYPE_CAST(unsigned long long, ~0ull)
170
171
/*--------------------------------------------------------------------------*/
172
/* Define named types and constants corresponding to specific integer
173
and floating-point sizes and signedness. */
174
175
/* Select an 8-bit integer type. */
176
#if VTK_SIZEOF_CHAR == 1
177
typedef
unsigned
char
vtkTypeUInt8;
178
typedef
signed
char
vtkTypeInt8;
179
#define VTK_TYPE_UINT8 VTK_UNSIGNED_CHAR
180
#define VTK_TYPE_UINT8_MIN VTK_UNSIGNED_CHAR_MIN
181
#define VTK_TYPE_UINT8_MAX VTK_UNSIGNED_CHAR_MAX
182
#if VTK_TYPE_CHAR_IS_SIGNED
183
#define VTK_TYPE_INT8 VTK_CHAR
184
#define VTK_TYPE_INT8_MIN VTK_CHAR_MIN
185
#define VTK_TYPE_INT8_MAX VTK_CHAR_MAX
186
#else
187
#define VTK_TYPE_INT8 VTK_SIGNED_CHAR
188
#define VTK_TYPE_INT8_MIN VTK_SIGNED_CHAR_MIN
189
#define VTK_TYPE_INT8_MAX VTK_SIGNED_CHAR_MAX
190
#endif
191
#else
192
#error "No native data type can represent an 8-bit integer."
193
#endif
194
195
/* Select a 16-bit integer type. */
196
#if VTK_SIZEOF_SHORT == 2
197
typedef
unsigned
short
vtkTypeUInt16;
198
typedef
signed
short
vtkTypeInt16;
199
#define VTK_TYPE_UINT16 VTK_UNSIGNED_SHORT
200
#define VTK_TYPE_UINT16_MIN VTK_UNSIGNED_SHORT_MIN
201
#define VTK_TYPE_UINT16_MAX VTK_UNSIGNED_SHORT_MAX
202
#define VTK_TYPE_INT16 VTK_SHORT
203
#define VTK_TYPE_INT16_MIN VTK_SHORT_MIN
204
#define VTK_TYPE_INT16_MAX VTK_SHORT_MAX
205
#elif VTK_SIZEOF_INT == 2
206
typedef
unsigned
int
vtkTypeUInt16;
207
typedef
signed
int
vtkTypeInt16;
208
#define VTK_TYPE_UINT16 VTK_UNSIGNED_INT
209
#define VTK_TYPE_UINT16_MIN VTK_UNSIGNED_INT_MIN
210
#define VTK_TYPE_UINT16_MAX VTK_UNSIGNED_INT_MAX
211
#define VTK_TYPE_INT16 VTK_INT
212
#define VTK_TYPE_INT16_MIN VTK_INT_MIN
213
#define VTK_TYPE_INT16_MAX VTK_INT_MAX
214
#else
215
#error "No native data type can represent a 16-bit integer."
216
#endif
217
218
/* Select a 32-bit integer type. */
219
#if VTK_SIZEOF_INT == 4
220
typedef
unsigned
int
vtkTypeUInt32;
221
typedef
signed
int
vtkTypeInt32;
222
#define VTK_TYPE_UINT32 VTK_UNSIGNED_INT
223
#define VTK_TYPE_UINT32_MIN VTK_UNSIGNED_INT_MIN
224
#define VTK_TYPE_UINT32_MAX VTK_UNSIGNED_INT_MAX
225
#define VTK_TYPE_INT32 VTK_INT
226
#define VTK_TYPE_INT32_MIN VTK_INT_MIN
227
#define VTK_TYPE_INT32_MAX VTK_INT_MAX
228
#elif VTK_SIZEOF_LONG == 4
229
typedef
unsigned
long
vtkTypeUInt32;
230
typedef
signed
long
vtkTypeInt32;
231
#define VTK_TYPE_UINT32 VTK_UNSIGNED_LONG
232
#define VTK_TYPE_UINT32_MIN VTK_UNSIGNED_LONG_MIN
233
#define VTK_TYPE_UINT32_MAX VTK_UNSIGNED_LONG_MAX
234
#define VTK_TYPE_INT32 VTK_LONG
235
#define VTK_TYPE_INT32_MIN VTK_LONG_MIN
236
#define VTK_TYPE_INT32_MAX VTK_LONG_MAX
237
#else
238
#error "No native data type can represent a 32-bit integer."
239
#endif
240
241
/* Select a 64-bit integer type. */
242
#if VTK_SIZEOF_LONG_LONG == 8
243
typedef
unsigned
long
long
vtkTypeUInt64;
244
typedef
signed
long
long
vtkTypeInt64;
245
#define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG_LONG
246
#define VTK_TYPE_UINT64_MIN VTK_UNSIGNED_LONG_LONG_MIN
247
#define VTK_TYPE_UINT64_MAX VTK_UNSIGNED_LONG_LONG_MAX
248
#define VTK_TYPE_INT64 VTK_LONG_LONG
249
#define VTK_TYPE_INT64_MIN VTK_LONG_LONG_MIN
250
#define VTK_TYPE_INT64_MAX VTK_LONG_LONG_MAX
251
#elif VTK_SIZEOF_LONG == 8
252
typedef
unsigned
long
vtkTypeUInt64;
253
typedef
signed
long
vtkTypeInt64;
254
#define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG
255
#define VTK_TYPE_UINT64_MIN VTK_UNSIGNED_LONG_MIN
256
#define VTK_TYPE_UINT64_MAX VTK_UNSIGNED_LONG_MAX
257
#define VTK_TYPE_INT64 VTK_LONG
258
#define VTK_TYPE_INT64_MIN VTK_LONG_MIN
259
#define VTK_TYPE_INT64_MAX VTK_LONG_MAX
260
#else
261
#error "No native data type can represent a 64-bit integer."
262
#endif
263
264
#if !defined(VTK_LEGACY_REMOVE)
265
// Provide this define to facilitate apps that need to support older
266
// versions that do not have vtkMTimeType
267
#define VTK_HAS_MTIME_TYPE
268
#endif
269
270
// If this is a 64-bit platform, or the user has indicated that 64-bit
271
// timestamps should be used, select an unsigned 64-bit integer type
272
// for use in MTime values. If possible, use 'unsigned long' as we have
273
// historically.
274
#if defined(VTK_USE_64BIT_TIMESTAMPS) || VTK_SIZEOF_VOID_P == 8
275
#if VTK_SIZEOF_LONG == 8
276
typedef
unsigned
long
vtkMTimeType
;
277
#define VTK_MTIME_TYPE_IMPL VTK_UNSIGNED_LONG
278
#define VTK_MTIME_MIN VTK_UNSIGNED_LONG_MIN
279
#define VTK_MTIME_MAX VTK_UNSIGNED_LONG_MAX
280
#else
281
typedef
vtkTypeUInt64
vtkMTimeType
;
282
#define VTK_MTIME_TYPE_IMPL VTK_TYPE_UINT64
283
#define VTK_MTIME_MIN VTK_TYPE_UINT64_MIN
284
#define VTK_MTIME_MAX VTK_TYPE_UINT64_MAX
285
#endif
286
#else
287
#if VTK_SIZEOF_LONG == 4
288
typedef
unsigned
long
vtkMTimeType
;
289
#define VTK_MTIME_TYPE_IMPL VTK_UNSIGNED_LONG
290
#define VTK_MTIME_MIN VTK_UNSIGNED_LONG_MIN
291
#define VTK_MTIME_MAX VTK_UNSIGNED_LONG_MAX
292
#else
293
typedef
vtkTypeUInt32
vtkMTimeType
;
294
#define VTK_MTIME_TYPE_IMPL VTK_TYPE_UINT32
295
#define VTK_MTIME_MIN VTK_TYPE_UINT32_MIN
296
#define VTK_MTIME_MAX VTK_TYPE_UINT32_MAX
297
#endif
298
#endif
299
300
/* Select a 32-bit floating point type. */
301
#if VTK_SIZEOF_FLOAT == 4
302
typedef
float
vtkTypeFloat32;
303
#define VTK_TYPE_FLOAT32 VTK_FLOAT
304
#else
305
#error "No native data type can represent a 32-bit floating point value."
306
#endif
307
308
/* Select a 64-bit floating point type. */
309
#if VTK_SIZEOF_DOUBLE == 8
310
typedef
double
vtkTypeFloat64;
311
#define VTK_TYPE_FLOAT64 VTK_DOUBLE
312
#else
313
#error "No native data type can represent a 64-bit floating point value."
314
#endif
315
316
/*--------------------------------------------------------------------------*/
317
/* Choose an implementation for vtkIdType. */
318
#define VTK_HAS_ID_TYPE
319
#ifdef VTK_USE_64BIT_IDS
320
#if VTK_SIZEOF_LONG_LONG == 8
321
typedef
long
long
vtkIdType
;
322
#define VTK_ID_TYPE_IMPL VTK_LONG_LONG
323
#define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG_LONG
324
#define VTK_ID_MIN VTK_LONG_LONG_MIN
325
#define VTK_ID_MAX VTK_LONG_LONG_MAX
326
#define VTK_ID_TYPE_PRId "lld"
327
#elif VTK_SIZEOF_LONG == 8
328
typedef
long
vtkIdType
;
329
#define VTK_ID_TYPE_IMPL VTK_LONG
330
#define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG
331
#define VTK_ID_MIN VTK_LONG_MIN
332
#define VTK_ID_MAX VTK_LONG_MAX
333
#define VTK_ID_TYPE_PRId "ld"
334
#else
335
#error "VTK_USE_64BIT_IDS is ON but no 64-bit integer type is available."
336
#endif
337
#else
338
typedef
int
vtkIdType
;
339
#define VTK_ID_TYPE_IMPL VTK_INT
340
#define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_INT
341
#define VTK_ID_MIN VTK_INT_MIN
342
#define VTK_ID_MAX VTK_INT_MAX
343
#define VTK_ID_TYPE_PRId "d"
344
#endif
345
346
#ifndef __cplusplus
347
// Make sure that when VTK headers are used by the C compiler we make
348
// sure to define the bool type. This is possible when using IO features
349
// like vtkXMLWriterC.h
350
#include "stdbool.h"
351
#endif
352
353
/*--------------------------------------------------------------------------*/
354
/* If not already defined, define vtkTypeBool. When VTK was started, some */
355
/* compilers did not yet support the bool type, and so VTK often used int, */
356
/* or more rarely unsigned int, where it should have used bool. */
357
/* Eventually vtkTypeBool will switch to real bool. */
358
#ifndef VTK_TYPE_BOOL_TYPEDEFED
359
#define VTK_TYPE_BOOL_TYPEDEFED
360
#if 1
361
typedef
int
vtkTypeBool
;
362
typedef
unsigned
int
vtkTypeUBool
;
363
#else
364
typedef
bool
vtkTypeBool
;
365
typedef
bool
vtkTypeUBool
;
366
#endif
367
#endif
368
369
#if defined(__cplusplus)
370
/* Description:
371
* Returns true if data type tags a and b point to the same data type. This
372
* is intended to handle vtkIdType, which does not have the same tag as its
373
* underlying data type.
374
* @note This method is only available when included from a C++ source file. */
375
inline
vtkTypeBool
vtkDataTypesCompare(
int
a,
int
b)
376
{
377
return
(a == b ||
378
((a ==
VTK_ID_TYPE
|| a ==
VTK_ID_TYPE_IMPL
) && (b ==
VTK_ID_TYPE
|| b ==
VTK_ID_TYPE_IMPL
)));
379
}
380
#endif
381
382
/*--------------------------------------------------------------------------*/
384
#define vtkInstantiateTemplateMacro(decl) \
385
decl<float>; \
386
decl<double>; \
387
decl<char>; \
388
decl<signed char>; \
389
decl<unsigned char>; \
390
decl<short>; \
391
decl<unsigned short>; \
392
decl<int>; \
393
decl<unsigned int>; \
394
decl<long>; \
395
decl<unsigned long>; \
396
decl<long long>; \
397
decl<unsigned long long>
398
400
#ifdef VTK_USE_EXTERN_TEMPLATE
401
#define vtkExternTemplateMacro(decl) vtkInstantiateTemplateMacro(decl)
402
#else
403
#define vtkExternTemplateMacro(decl)
404
#endif
405
406
#endif
407
// VTK-HeaderTest-Exclude: vtkType.h
vtkIdType
int vtkIdType
Definition:
vtkType.h:338
vtkTypeUBool
unsigned int vtkTypeUBool
Definition:
vtkType.h:362
vtkCompiler.h
VTK_ID_TYPE_IMPL
#define VTK_ID_TYPE_IMPL
Definition:
vtkType.h:339
VTK_ID_TYPE
#define VTK_ID_TYPE
Definition:
vtkType.h:56
vtkTypeBool
int vtkTypeBool
Definition:
vtkType.h:361
vtkTypeBool
int vtkTypeBool
Definition:
vtkABI.h:69
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition:
vtkType.h:293
Generated on Mon Mar 8 2021 04:40:31 for VTK by
1.8.20