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