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