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