VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkType.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 #ifndef vtkType_h 00016 #define vtkType_h 00017 00018 #include "vtkConfigure.h" 00019 00020 /*--------------------------------------------------------------------------*/ 00021 /* Define a unique integer identifier for each native scalar type. */ 00022 00023 /* These types are returned by GetDataType to indicate pixel type. */ 00024 #define VTK_VOID 0 00025 #define VTK_BIT 1 00026 #define VTK_CHAR 2 00027 #define VTK_SIGNED_CHAR 15 00028 #define VTK_UNSIGNED_CHAR 3 00029 #define VTK_SHORT 4 00030 #define VTK_UNSIGNED_SHORT 5 00031 #define VTK_INT 6 00032 #define VTK_UNSIGNED_INT 7 00033 #define VTK_LONG 8 00034 #define VTK_UNSIGNED_LONG 9 00035 #define VTK_FLOAT 10 00036 #define VTK_DOUBLE 11 00037 #define VTK_ID_TYPE 12 00038 00039 /* These types are not currently supported by GetDataType, but are for 00040 completeness. */ 00041 #define VTK_STRING 13 00042 #define VTK_OPAQUE 14 00043 00044 /* These types are enabled if VTK_TYPE_USE_LONG_LONG is defined. */ 00045 #define VTK_LONG_LONG 16 00046 #define VTK_UNSIGNED_LONG_LONG 17 00047 00048 /* This type is enabled if VTK_TYPE_USE___INT64 is defined. */ 00049 #define VTK___INT64 18 00050 00051 /* This type is enabled if VTK_TYPE_USE___INT64 and 00052 VTK_TYPE_CONVERT_UI64_TO_DOUBLE are both defined. */ 00053 #define VTK_UNSIGNED___INT64 19 00054 00055 /* These types are required by vtkVariant and vtkVariantArray */ 00056 #define VTK_VARIANT 20 00057 #define VTK_OBJECT 21 00058 00059 /* Storage for Unicode strings */ 00060 #define VTK_UNICODE_STRING 22 00061 00062 /*--------------------------------------------------------------------------*/ 00063 /* Define a unique integer identifier for each vtkDataObject type. */ 00064 /* When adding a new data type here, make sure to update */ 00065 /* vtkDataObjectTypes as well. */ 00066 #define VTK_POLY_DATA 0 00067 #define VTK_STRUCTURED_POINTS 1 00068 #define VTK_STRUCTURED_GRID 2 00069 #define VTK_RECTILINEAR_GRID 3 00070 #define VTK_UNSTRUCTURED_GRID 4 00071 #define VTK_PIECEWISE_FUNCTION 5 00072 #define VTK_IMAGE_DATA 6 00073 #define VTK_DATA_OBJECT 7 00074 #define VTK_DATA_SET 8 00075 #define VTK_POINT_SET 9 00076 #define VTK_UNIFORM_GRID 10 00077 #define VTK_COMPOSITE_DATA_SET 11 00078 #define VTK_MULTIGROUP_DATA_SET 12 00079 #define VTK_MULTIBLOCK_DATA_SET 13 00080 #define VTK_HIERARCHICAL_DATA_SET 14 00081 #define VTK_HIERARCHICAL_BOX_DATA_SET 15 00082 #define VTK_GENERIC_DATA_SET 16 00083 #define VTK_HYPER_OCTREE 17 00084 #define VTK_TEMPORAL_DATA_SET 18 00085 #define VTK_TABLE 19 00086 #define VTK_GRAPH 20 00087 #define VTK_TREE 21 00088 #define VTK_SELECTION 22 00089 #define VTK_DIRECTED_GRAPH 23 00090 #define VTK_UNDIRECTED_GRAPH 24 00091 #define VTK_MULTIPIECE_DATA_SET 25 00092 #define VTK_DIRECTED_ACYCLIC_GRAPH 26 00093 #define VTK_ARRAY_DATA 27 00094 #define VTK_REEB_GRAPH 28 00095 #define VTK_UNIFORM_GRID_AMR 29 00096 #define VTK_NON_OVERLAPPING_AMR 30 00097 #define VTK_OVERLAPPING_AMR 31 00098 #define VTK_HYPER_TREE_GRID 32 00099 #define VTK_MOLECULE 33 00100 #define VTK_PISTON_DATA_OBJECT 34 00101 #define VTK_PATH 35 00102 #define VTK_UNSTRUCTURED_GRID_BASE 36 00103 00104 /*--------------------------------------------------------------------------*/ 00105 /* Define a casting macro for use by the constants below. */ 00106 #if defined(__cplusplus) 00107 # define VTK_TYPE_CAST(T, V) static_cast< T >(V) 00108 #else 00109 # define VTK_TYPE_CAST(T, V) ((T)(V)) 00110 #endif 00111 00112 /*--------------------------------------------------------------------------*/ 00113 /* Define min/max constants for each type. */ 00114 #define VTK_BIT_MIN 0 00115 #define VTK_BIT_MAX 1 00116 #if VTK_TYPE_CHAR_IS_SIGNED 00117 # define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0x80) 00118 # define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0x7f) 00119 #else 00120 # define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0u) 00121 # define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0xffu) 00122 #endif 00123 #define VTK_SIGNED_CHAR_MIN VTK_TYPE_CAST(signed char, 0x80) 00124 #define VTK_SIGNED_CHAR_MAX VTK_TYPE_CAST(signed char, 0x7f) 00125 #define VTK_UNSIGNED_CHAR_MIN VTK_TYPE_CAST(unsigned char, 0u) 00126 #define VTK_UNSIGNED_CHAR_MAX VTK_TYPE_CAST(unsigned char, 0xffu) 00127 #define VTK_SHORT_MIN VTK_TYPE_CAST(short, 0x8000) 00128 #define VTK_SHORT_MAX VTK_TYPE_CAST(short, 0x7fff) 00129 #define VTK_UNSIGNED_SHORT_MIN VTK_TYPE_CAST(unsigned short, 0u) 00130 #define VTK_UNSIGNED_SHORT_MAX VTK_TYPE_CAST(unsigned short, 0xffffu) 00131 #define VTK_INT_MIN VTK_TYPE_CAST(int, ~(~0u >> 1)) 00132 #define VTK_INT_MAX VTK_TYPE_CAST(int, ~0u >> 1) 00133 #define VTK_UNSIGNED_INT_MIN VTK_TYPE_CAST(unsigned int, 0) 00134 #define VTK_UNSIGNED_INT_MAX VTK_TYPE_CAST(unsigned int, ~0u) 00135 #define VTK_LONG_MIN VTK_TYPE_CAST(long, ~(~0ul >> 1)) 00136 #define VTK_LONG_MAX VTK_TYPE_CAST(long, ~0ul >> 1) 00137 #define VTK_UNSIGNED_LONG_MIN VTK_TYPE_CAST(unsigned long, 0ul) 00138 #define VTK_UNSIGNED_LONG_MAX VTK_TYPE_CAST(unsigned long, ~0ul) 00139 #define VTK_FLOAT_MIN VTK_TYPE_CAST(float, -1.0e+38f) 00140 #define VTK_FLOAT_MAX VTK_TYPE_CAST(float, 1.0e+38f) 00141 #define VTK_DOUBLE_MIN VTK_TYPE_CAST(double, -1.0e+299) 00142 #define VTK_DOUBLE_MAX VTK_TYPE_CAST(double, 1.0e+299) 00143 #if defined(VTK_SIZEOF_LONG_LONG) 00144 # define VTK_LONG_LONG_MIN VTK_TYPE_CAST(long long, ~(~0ull >> 1)) 00145 # define VTK_LONG_LONG_MAX VTK_TYPE_CAST(long long, ~0ull >> 1) 00146 # define VTK_UNSIGNED_LONG_LONG_MIN VTK_TYPE_CAST(unsigned long long, 0ull) 00147 # define VTK_UNSIGNED_LONG_LONG_MAX VTK_TYPE_CAST(unsigned long long, ~0ull) 00148 #endif 00149 #if defined(VTK_SIZEOF___INT64) 00150 # if defined(VTK_TYPE_SAME_LONG_AND___INT64) 00151 # define VTK___INT64_MIN VTK_TYPE_CAST(__int64, ~(~0ul >> 1)) 00152 # define VTK___INT64_MAX VTK_TYPE_CAST(__int64, ~0ul >> 1) 00153 # define VTK_UNSIGNED___INT64_MIN VTK_TYPE_CAST(unsigned __int64, 0ul) 00154 # define VTK_UNSIGNED___INT64_MAX VTK_TYPE_CAST(unsigned __int64, ~0ul) 00155 # elif defined(VTK_TYPE_SAME_LONG_LONG_AND___INT64) 00156 # define VTK___INT64_MIN VTK_TYPE_CAST(__int64, ~(~0ull >> 1)) 00157 # define VTK___INT64_MAX VTK_TYPE_CAST(__int64, ~0ull >> 1) 00158 # define VTK_UNSIGNED___INT64_MIN VTK_TYPE_CAST(unsigned __int64, 0ull) 00159 # define VTK_UNSIGNED___INT64_MAX VTK_TYPE_CAST(unsigned __int64, ~0ull) 00160 # else 00161 # define VTK___INT64_MIN VTK_TYPE_CAST(__int64, ~(~0ui64 >> 1)) 00162 # define VTK___INT64_MAX VTK_TYPE_CAST(__int64, ~0ui64 >> 1) 00163 # define VTK_UNSIGNED___INT64_MIN VTK_TYPE_CAST(unsigned __int64, 0ui64) 00164 # define VTK_UNSIGNED___INT64_MAX VTK_TYPE_CAST(unsigned __int64, ~0ui64) 00165 # endif 00166 #endif 00167 00168 /* Define compatibility names for these constants. */ 00169 #if !defined(VTK_LEGACY_REMOVE) 00170 # define VTK_LARGE_INTEGER VTK_INT_MAX 00171 # define VTK_LARGE_FLOAT VTK_FLOAT_MAX 00172 #endif 00173 00174 /*--------------------------------------------------------------------------*/ 00175 /* Define named types and constants corresponding to specific integer 00176 and floating-point sizes and signedness. */ 00177 00178 /* Select an 8-bit integer type. */ 00179 #if VTK_SIZEOF_CHAR == 1 00180 typedef unsigned char vtkTypeUInt8; 00181 typedef signed char vtkTypeInt8; 00182 # define VTK_TYPE_UINT8 VTK_UNSIGNED_CHAR 00183 # if VTK_TYPE_CHAR_IS_SIGNED 00184 # define VTK_TYPE_INT8 VTK_CHAR 00185 # else 00186 # define VTK_TYPE_INT8 VTK_SIGNED_CHAR 00187 # endif 00188 #else 00189 # error "No native data type can represent an 8-bit integer." 00190 #endif 00191 00192 /* Select a 16-bit integer type. */ 00193 #if VTK_SIZEOF_SHORT == 2 00194 typedef unsigned short vtkTypeUInt16; 00195 typedef signed short vtkTypeInt16; 00196 # define VTK_TYPE_UINT16 VTK_UNSIGNED_SHORT 00197 # define VTK_TYPE_INT16 VTK_SHORT 00198 #elif VTK_SIZEOF_INT == 2 00199 typedef unsigned int vtkTypeUInt16; 00200 typedef signed int vtkTypeInt16; 00201 # define VTK_TYPE_UINT16 VTK_UNSIGNED_INT 00202 # define VTK_TYPE_INT16 VTK_INT 00203 #else 00204 # error "No native data type can represent a 16-bit integer." 00205 #endif 00206 00207 /* Select a 32-bit integer type. */ 00208 #if VTK_SIZEOF_INT == 4 00209 typedef unsigned int vtkTypeUInt32; 00210 typedef signed int vtkTypeInt32; 00211 # define VTK_TYPE_UINT32 VTK_UNSIGNED_INT 00212 # define VTK_TYPE_INT32 VTK_INT 00213 #elif VTK_SIZEOF_LONG == 4 00214 typedef unsigned long vtkTypeUInt32; 00215 typedef signed long vtkTypeInt32; 00216 # define VTK_TYPE_UINT32 VTK_UNSIGNED_LONG 00217 # define VTK_TYPE_INT32 VTK_LONG 00218 #else 00219 # error "No native data type can represent a 32-bit integer." 00220 #endif 00221 00222 /* Select a 64-bit integer type. */ 00223 #if defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8 00224 typedef unsigned long long vtkTypeUInt64; 00225 typedef signed long long vtkTypeInt64; 00226 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG_LONG 00227 # define VTK_TYPE_INT64 VTK_LONG_LONG 00228 #elif VTK_SIZEOF_LONG == 8 00229 typedef unsigned long vtkTypeUInt64; 00230 typedef signed long vtkTypeInt64; 00231 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG 00232 # define VTK_TYPE_INT64 VTK_LONG 00233 #elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8 00234 typedef unsigned __int64 vtkTypeUInt64; 00235 typedef signed __int64 vtkTypeInt64; 00236 # define VTK_TYPE_UINT64 VTK_UNSIGNED___INT64 00237 # define VTK_TYPE_INT64 VTK___INT64 00238 #else 00239 # error "No native data type can represent a 64-bit integer." 00240 #endif 00241 00242 /* Select a 32-bit floating point type. */ 00243 #if VTK_SIZEOF_FLOAT == 4 00244 typedef float vtkTypeFloat32; 00245 # define VTK_TYPE_FLOAT32 VTK_FLOAT 00246 #else 00247 # error "No native data type can represent a 32-bit floating point value." 00248 #endif 00249 00250 /* Select a 64-bit floating point type. */ 00251 #if VTK_SIZEOF_DOUBLE == 8 00252 typedef double vtkTypeFloat64; 00253 # define VTK_TYPE_FLOAT64 VTK_DOUBLE 00254 #else 00255 # error "No native data type can represent a 64-bit floating point value." 00256 #endif 00257 00258 /*--------------------------------------------------------------------------*/ 00259 /* Choose an implementation for vtkIdType. */ 00260 #define VTK_HAS_ID_TYPE 00261 #ifdef VTK_USE_64BIT_IDS 00262 # if defined(VTK_SIZEOF_LONG) && VTK_SIZEOF_LONG == 8 && 0 00263 typedef long vtkIdType; 00264 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG 00265 # define VTK_ID_MIN VTK_LONG_MIN 00266 # define VTK_ID_MAX VTK_LONG_MAX 00267 # elif defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8 00268 typedef long long vtkIdType; 00269 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG_LONG 00270 # define VTK_ID_MIN VTK_LONG_LONG_MIN 00271 # define VTK_ID_MAX VTK_LONG_LONG_MAX 00272 # elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8 00273 typedef __int64 vtkIdType; 00274 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF___INT64 00275 # define VTK_ID_MIN VTK___INT64_MIN 00276 # define VTK_ID_MAX VTK___INT64_MAX 00277 # else 00278 # error "VTK_USE_64BIT_IDS is ON but no 64-bit integer type is available." 00279 # endif 00280 #else 00281 typedef int vtkIdType; 00282 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_INT 00283 # define VTK_ID_MIN VTK_INT_MIN 00284 # define VTK_ID_MAX VTK_INT_MAX 00285 #endif 00286 00287 /*--------------------------------------------------------------------------*/ 00288 /* Provide deprecated pre-VTK6 constant. */ 00289 #if !defined(VTK_LEGACY_REMOVE) 00290 # define VTK_LARGE_ID VTK_ID_MAX 00291 #endif 00292 00293 /*--------------------------------------------------------------------------*/ 00294 /* Define the type of floating point interface used for old and new 00295 versions of VTK. VTK 4.2 and older use float and VTK 4.4 and newer 00296 use double for most of the API calls. */ 00297 #if !defined(VTK_LEGACY_REMOVE) 00298 # define vtkFloatingPointType double 00299 #endif 00300 00301 #endif 00302 // VTK-HeaderTest-Exclude: vtkType.h