VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkTemplateAliasMacro.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 =========================================================================*/ 00038 #ifndef __vtkTemplateAliasMacro_h 00039 #define __vtkTemplateAliasMacro_h 00040 00041 #include "vtkTypeTraits.h" 00042 00043 // Allow individual switching of support for each scalar size/signedness. 00044 // These could be made advanced user options to be configured by CMake. 00045 #define VTK_USE_INT8 1 00046 #define VTK_USE_UINT8 1 00047 #define VTK_USE_INT16 1 00048 #define VTK_USE_UINT16 1 00049 #define VTK_USE_INT32 1 00050 #define VTK_USE_UINT32 1 00051 #define VTK_USE_INT64 1 00052 #define VTK_USE_UINT64 1 00053 #define VTK_USE_FLOAT32 1 00054 #define VTK_USE_FLOAT64 1 00055 00056 // Force UINT64 off if we cannot implement support for it. 00057 #if defined(VTK_TYPE_USE___INT64) && !defined(VTK_TYPE_CONVERT_UI64_TO_DOUBLE) 00058 # undef VTK_USE_UINT64 00059 # define VTK_USE_UINT64 0 00060 #endif 00061 00062 //-------------------------------------------------------------------------- 00063 00064 // Define helper macros to switch types on and off. 00065 #define vtkTemplateAliasMacroCase(typeN, call) \ 00066 vtkTemplateAliasMacroCase0(typeN, call, VTK_TYPE_SIZED_##typeN) 00067 #define vtkTemplateAliasMacroCase0(typeN, call, sized) \ 00068 vtkTemplateAliasMacroCase1(typeN, call, sized) 00069 #define vtkTemplateAliasMacroCase1(typeN, call, sized) \ 00070 vtkTemplateAliasMacroCase2(typeN, call, VTK_USE_##sized) 00071 #define vtkTemplateAliasMacroCase2(typeN, call, value) \ 00072 vtkTemplateAliasMacroCase3(typeN, call, value) 00073 #define vtkTemplateAliasMacroCase3(typeN, call, value) \ 00074 vtkTemplateAliasMacroCase_##value(typeN, call) 00075 #define vtkTemplateAliasMacroCase_0(typeN, call) \ 00076 case VTK_##typeN: \ 00077 { \ 00078 vtkGenericWarningMacro("Support for VTK_" #typeN " not compiled."); \ 00079 }; break 00080 #define vtkTemplateAliasMacroCase_1(typeN, call) \ 00081 case VTK_##typeN: \ 00082 { \ 00083 typedef vtkTypeTraits<VTK_TYPE_NAME_##typeN>::SizedType VTK_TT; call; \ 00084 }; break 00085 00086 // Add "long long" to the template macro if it is enabled. 00087 #if defined(VTK_TYPE_USE_LONG_LONG) 00088 # define vtkTemplateAliasMacroCase_ll(typeN, call) \ 00089 vtkTemplateAliasMacroCase(typeN, call); 00090 #else 00091 # define vtkTemplateAliasMacroCase_ll(typeN, call) 00092 #endif 00093 00094 // Add "__int64" to the template macro if it is enabled. 00095 #if defined(VTK_TYPE_USE___INT64) 00096 # define vtkTemplateAliasMacroCase_i64(typeN, call) \ 00097 vtkTemplateAliasMacroCase(typeN, call); 00098 #else 00099 # define vtkTemplateAliasMacroCase_i64(typeN, call) 00100 #endif 00101 00102 // Define a macro to dispatch calls to a template instantiated over 00103 // the aliased scalar types. 00104 #define vtkTemplateAliasMacro(call) \ 00105 vtkTemplateAliasMacroCase(DOUBLE, call); \ 00106 vtkTemplateAliasMacroCase(FLOAT, call); \ 00107 vtkTemplateAliasMacroCase_ll(LONG_LONG, call) \ 00108 vtkTemplateAliasMacroCase_ll(UNSIGNED_LONG_LONG, call) \ 00109 vtkTemplateAliasMacroCase_i64(__INT64, call) \ 00110 vtkTemplateAliasMacroCase_i64(UNSIGNED___INT64, call) \ 00111 vtkTemplateAliasMacroCase(ID_TYPE, call); \ 00112 vtkTemplateAliasMacroCase(LONG, call); \ 00113 vtkTemplateAliasMacroCase(UNSIGNED_LONG, call); \ 00114 vtkTemplateAliasMacroCase(INT, call); \ 00115 vtkTemplateAliasMacroCase(UNSIGNED_INT, call); \ 00116 vtkTemplateAliasMacroCase(SHORT, call); \ 00117 vtkTemplateAliasMacroCase(UNSIGNED_SHORT, call); \ 00118 vtkTemplateAliasMacroCase(CHAR, call); \ 00119 vtkTemplateAliasMacroCase(SIGNED_CHAR, call); \ 00120 vtkTemplateAliasMacroCase(UNSIGNED_CHAR, call) 00121 00122 #endif 00123 // VTK-HeaderTest-Exclude: vtkTemplateAliasMacro.h