VTK  9.1.0
vtkTemplateAliasMacro.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTemplateAliasMacro.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
39#ifndef vtkTemplateAliasMacro_h
40#define vtkTemplateAliasMacro_h
41
42#include "vtkTypeTraits.h"
43
44// Allow individual switching of support for each scalar size/signedness.
45// These could be made advanced user options to be configured by CMake.
46#define VTK_USE_INT8 1
47#define VTK_USE_UINT8 1
48#define VTK_USE_INT16 1
49#define VTK_USE_UINT16 1
50#define VTK_USE_INT32 1
51#define VTK_USE_UINT32 1
52#define VTK_USE_INT64 1
53#define VTK_USE_UINT64 1
54#define VTK_USE_FLOAT32 1
55#define VTK_USE_FLOAT64 1
56
57//--------------------------------------------------------------------------
58
59// Define helper macros to switch types on and off.
60#define vtkTemplateAliasMacroCase(typeN, call) \
61 vtkTemplateAliasMacroCase0(typeN, call, VTK_TYPE_SIZED_##typeN)
62#define vtkTemplateAliasMacroCase0(typeN, call, sized) \
63 vtkTemplateAliasMacroCase1(typeN, call, sized)
64#define vtkTemplateAliasMacroCase1(typeN, call, sized) \
65 vtkTemplateAliasMacroCase2(typeN, call, VTK_USE_##sized)
66#define vtkTemplateAliasMacroCase2(typeN, call, value) \
67 vtkTemplateAliasMacroCase3(typeN, call, value)
68#define vtkTemplateAliasMacroCase3(typeN, call, value) \
69 vtkTemplateAliasMacroCase_##value(typeN, call)
70#define vtkTemplateAliasMacroCase_0(typeN, call) \
71 case VTK_##typeN: \
72 { \
73 vtkGenericWarningMacro("Support for VTK_" #typeN " not compiled."); \
74 }; \
75 break
76#define vtkTemplateAliasMacroCase_1(typeN, call) \
77 case VTK_##typeN: \
78 { \
79 typedef vtkTypeTraits<VTK_TYPE_NAME_##typeN>::SizedType VTK_TT; \
80 call; \
81 }; \
82 break
83
84// Define a macro to dispatch calls to a template instantiated over
85// the aliased scalar types.
86#define vtkTemplateAliasMacro(call) \
87 vtkTemplateAliasMacroCase(DOUBLE, call); \
88 vtkTemplateAliasMacroCase(FLOAT, call); \
89 vtkTemplateAliasMacroCase(LONG_LONG, call); \
90 vtkTemplateAliasMacroCase(UNSIGNED_LONG_LONG, call); \
91 vtkTemplateAliasMacroCase(ID_TYPE, call); \
92 vtkTemplateAliasMacroCase(LONG, call); \
93 vtkTemplateAliasMacroCase(UNSIGNED_LONG, call); \
94 vtkTemplateAliasMacroCase(INT, call); \
95 vtkTemplateAliasMacroCase(UNSIGNED_INT, call); \
96 vtkTemplateAliasMacroCase(SHORT, call); \
97 vtkTemplateAliasMacroCase(UNSIGNED_SHORT, call); \
98 vtkTemplateAliasMacroCase(CHAR, call); \
99 vtkTemplateAliasMacroCase(SIGNED_CHAR, call); \
100 vtkTemplateAliasMacroCase(UNSIGNED_CHAR, call)
101
102#endif
103// VTK-HeaderTest-Exclude: vtkTemplateAliasMacro.h