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