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 00096 /*--------------------------------------------------------------------------*/ 00097 /* Define a casting macro for use by the constants below. */ 00098 #if defined(__cplusplus) 00099 # define VTK_TYPE_CAST(T, V) static_cast< T >(V) 00100 #else 00101 # define VTK_TYPE_CAST(T, V) ((T)(V)) 00102 #endif 00103 00104 /*--------------------------------------------------------------------------*/ 00105 /* Define min/max constants for each type. */ 00106 #define VTK_BIT_MIN 0 00107 #define VTK_BIT_MAX 1 00108 #if VTK_TYPE_CHAR_IS_SIGNED 00109 # define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0x80) 00110 # define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0x7f) 00111 #else 00112 # define VTK_CHAR_MIN VTK_TYPE_CAST(char, 0u) 00113 # define VTK_CHAR_MAX VTK_TYPE_CAST(char, 0xffu) 00114 #endif 00115 #define VTK_SIGNED_CHAR_MIN VTK_TYPE_CAST(signed char, 0x80) 00116 #define VTK_SIGNED_CHAR_MAX VTK_TYPE_CAST(signed char, 0x7f) 00117 #define VTK_UNSIGNED_CHAR_MIN VTK_TYPE_CAST(unsigned char, 0u) 00118 #define VTK_UNSIGNED_CHAR_MAX VTK_TYPE_CAST(unsigned char, 0xffu) 00119 #define VTK_SHORT_MIN VTK_TYPE_CAST(short, 0x8000) 00120 #define VTK_SHORT_MAX VTK_TYPE_CAST(short, 0x7fff) 00121 #define VTK_UNSIGNED_SHORT_MIN VTK_TYPE_CAST(unsigned short, 0u) 00122 #define VTK_UNSIGNED_SHORT_MAX VTK_TYPE_CAST(unsigned short, 0xffffu) 00123 #define VTK_INT_MIN VTK_TYPE_CAST(int, ~(~0u >> 1)) 00124 #define VTK_INT_MAX VTK_TYPE_CAST(int, ~0u >> 1) 00125 #define VTK_UNSIGNED_INT_MIN VTK_TYPE_CAST(unsigned int, 0) 00126 #define VTK_UNSIGNED_INT_MAX VTK_TYPE_CAST(unsigned int, ~0u) 00127 #define VTK_LONG_MIN VTK_TYPE_CAST(long, ~(~0ul >> 1)) 00128 #define VTK_LONG_MAX VTK_TYPE_CAST(long, ~0ul >> 1) 00129 #define VTK_UNSIGNED_LONG_MIN VTK_TYPE_CAST(unsigned long, 0ul) 00130 #define VTK_UNSIGNED_LONG_MAX VTK_TYPE_CAST(unsigned long, ~0ul) 00131 #define VTK_FLOAT_MIN VTK_TYPE_CAST(float, -1.0e+38f) 00132 #define VTK_FLOAT_MAX VTK_TYPE_CAST(float, 1.0e+38f) 00133 #define VTK_DOUBLE_MIN VTK_TYPE_CAST(double, -1.0e+299) 00134 #define VTK_DOUBLE_MAX VTK_TYPE_CAST(double, 1.0e+299) 00135 #if defined(VTK_SIZEOF_LONG_LONG) 00136 # define VTK_LONG_LONG_MIN VTK_TYPE_CAST(long long, ~(~0ull >> 1)) 00137 # define VTK_LONG_LONG_MAX VTK_TYPE_CAST(long long, ~0ull >> 1) 00138 # define VTK_UNSIGNED_LONG_LONG_MIN VTK_TYPE_CAST(unsigned long long, 0ull) 00139 # define VTK_UNSIGNED_LONG_LONG_MAX VTK_TYPE_CAST(unsigned long long, ~0ull) 00140 #endif 00141 #if defined(VTK_SIZEOF___INT64) 00142 # define VTK___INT64_MIN VTK_TYPE_CAST(__int64, ~(~0ui64 >> 1)) 00143 # define VTK___INT64_MAX VTK_TYPE_CAST(__int64, ~0ui64 >> 1) 00144 # define VTK_UNSIGNED___INT64_MIN VTK_TYPE_CAST(unsigned __int64, 0ui64) 00145 # define VTK_UNSIGNED___INT64_MAX VTK_TYPE_CAST(unsigned __int64, ~0ui64) 00146 #endif 00147 00148 /* Define compatibility names for these constants. */ 00149 #define VTK_LARGE_INTEGER VTK_INT_MAX 00150 #define VTK_LARGE_FLOAT VTK_FLOAT_MAX 00151 00152 /*--------------------------------------------------------------------------*/ 00153 /* Define named types and constants corresponding to specific integer 00154 and floating-point sizes and signedness. */ 00155 00156 /* Select an 8-bit integer type. */ 00157 #if VTK_SIZEOF_CHAR == 1 00158 typedef unsigned char vtkTypeUInt8; 00159 typedef signed char vtkTypeInt8; 00160 # define VTK_TYPE_UINT8 VTK_UNSIGNED_CHAR 00161 # if VTK_TYPE_CHAR_IS_SIGNED 00162 # define VTK_TYPE_INT8 VTK_CHAR 00163 # else 00164 # define VTK_TYPE_INT8 VTK_SIGNED_CHAR 00165 # endif 00166 #else 00167 # error "No native data type can represent an 8-bit integer." 00168 #endif 00169 00170 /* Select a 16-bit integer type. */ 00171 #if VTK_SIZEOF_SHORT == 2 00172 typedef unsigned short vtkTypeUInt16; 00173 typedef signed short vtkTypeInt16; 00174 # define VTK_TYPE_UINT16 VTK_UNSIGNED_SHORT 00175 # define VTK_TYPE_INT16 VTK_SHORT 00176 #elif VTK_SIZEOF_INT == 2 00177 typedef unsigned int vtkTypeUInt16; 00178 typedef signed int vtkTypeInt16; 00179 # define VTK_TYPE_UINT16 VTK_UNSIGNED_INT 00180 # define VTK_TYPE_INT16 VTK_INT 00181 #else 00182 # error "No native data type can represent a 16-bit integer." 00183 #endif 00184 00185 /* Select a 32-bit integer type. */ 00186 #if VTK_SIZEOF_INT == 4 00187 typedef unsigned int vtkTypeUInt32; 00188 typedef signed int vtkTypeInt32; 00189 # define VTK_TYPE_UINT32 VTK_UNSIGNED_INT 00190 # define VTK_TYPE_INT32 VTK_INT 00191 #elif VTK_SIZEOF_LONG == 4 00192 typedef unsigned long vtkTypeUInt32; 00193 typedef signed long vtkTypeInt32; 00194 # define VTK_TYPE_UINT32 VTK_UNSIGNED_LONG 00195 # define VTK_TYPE_INT32 VTK_LONG 00196 #else 00197 # error "No native data type can represent a 32-bit integer." 00198 #endif 00199 00200 /* Select a 64-bit integer type. */ 00201 #if defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8 00202 typedef unsigned long long vtkTypeUInt64; 00203 typedef signed long long vtkTypeInt64; 00204 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG_LONG 00205 # define VTK_TYPE_INT64 VTK_LONG_LONG 00206 #elif VTK_SIZEOF_LONG == 8 00207 typedef unsigned long vtkTypeUInt64; 00208 typedef signed long vtkTypeInt64; 00209 # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG 00210 # define VTK_TYPE_INT64 VTK_LONG 00211 #elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8 00212 typedef unsigned __int64 vtkTypeUInt64; 00213 typedef signed __int64 vtkTypeInt64; 00214 # define VTK_TYPE_UINT64 VTK_UNSIGNED___INT64 00215 # define VTK_TYPE_INT64 VTK___INT64 00216 #else 00217 # error "No native data type can represent a 64-bit integer." 00218 #endif 00219 00220 /* Select a 32-bit floating point type. */ 00221 #if VTK_SIZEOF_FLOAT == 4 00222 typedef float vtkTypeFloat32; 00223 # define VTK_TYPE_FLOAT32 VTK_FLOAT 00224 #else 00225 # error "No native data type can represent a 32-bit floating point value." 00226 #endif 00227 00228 /* Select a 64-bit floating point type. */ 00229 #if VTK_SIZEOF_DOUBLE == 8 00230 typedef double vtkTypeFloat64; 00231 # define VTK_TYPE_FLOAT64 VTK_DOUBLE 00232 #else 00233 # error "No native data type can represent a 64-bit floating point value." 00234 #endif 00235 00236 /*--------------------------------------------------------------------------*/ 00237 /* Choose an implementation for vtkIdType. */ 00238 #define VTK_HAS_ID_TYPE 00239 #ifdef VTK_USE_64BIT_IDS 00240 # if defined(VTK_SIZEOF_LONG) && VTK_SIZEOF_LONG == 8 && 0 00241 typedef long vtkIdType; 00242 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG 00243 # define VTK_LARGE_ID VTK_LONG_MAX 00244 # elif defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8 00245 typedef long long vtkIdType; 00246 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_LONG_LONG 00247 # define VTK_LARGE_ID VTK_LONG_LONG_MAX 00248 # elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8 00249 typedef __int64 vtkIdType; 00250 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF___INT64 00251 # define VTK_LARGE_ID VTK___INT64_MAX 00252 # else 00253 # error "VTK_USE_64BIT_IDS is ON but no 64-bit integer type is available." 00254 # endif 00255 #else 00256 typedef int vtkIdType; 00257 # define VTK_SIZEOF_ID_TYPE VTK_SIZEOF_INT 00258 # define VTK_LARGE_ID VTK_INT_MAX 00259 #endif 00260 00261 /*--------------------------------------------------------------------------*/ 00262 /* Define the type of floating point interface used for old and new 00263 versions of VTK. VTK 4.2 and older use float and VTK 4.4 and newer 00264 use double for most of the API calls. */ 00265 #define vtkFloatingPointType vtkFloatingPointType 00266 typedef double vtkFloatingPointType; 00267 00268 #endif