VTK: Common/Core/vtkConstantImplicitBackend.h Source File

| VTK 9.3.1

vtkConstantImplicitBackend.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Funded by CEA, DAM, DIF, F-91297 Arpajon, France
4 #ifndef vtkConstantImplicitBackend_h
5 #define vtkConstantImplicitBackend_h
6
7 #include "vtkCommonCoreModule.h"
8 #include "vtkCompiler.h" // For VTK_USE_EXTERN_TEMPLATE
9 #include "vtkSetGet.h" // for vtkNotUsed
10 #include "vtkType.h" // For vtkExternTemplateMacro
11
33 VTK_ABI_NAMESPACE_BEGIN
34 template <typename ValueType>
35 struct VTKCOMMONCORE_EXPORT vtkConstantImplicitBackend final
36 {
42 vtkConstantImplicitBackend(ValueType val)
43 : Value(val)
44 {
45 }
46
52 ValueType operator()(int vtkNotUsed(index)) const { return this->Value; }
53
57 const ValueType Value;
58 };
59 VTK_ABI_NAMESPACE_END
60
61 #endif // vtkConstantImplicitBackend_h
62
63 #if defined(VTK_CONSTANT_BACKEND_INSTANTIATING)
64
65 #define VTK_INSTANTIATE_CONSTANT_BACKEND(ValueType) \
66 VTK_ABI_NAMESPACE_BEGIN \
67 template struct VTKCOMMONCORE_EXPORT vtkConstantImplicitBackend<ValueType>; \
68 VTK_ABI_NAMESPACE_END
69
70 #elif defined(VTK_USE_EXTERN_TEMPLATE)
71
72 #ifndef VTK_CONSTANT_BACKEND_TEMPLATE_EXTERN
73 #define VTK_CONSTANT_BACKEND_TEMPLATE_EXTERN
74 #ifdef _MSC_VER
75 #pragma warning(push)
76 #pragma warning(disable : 4910) // extern and dllexport incompatible
77 #endif
78 VTK_ABI_NAMESPACE_BEGIN
79 vtkExternTemplateMacro(extern template struct VTKCOMMONCORE_EXPORT vtkConstantImplicitBackend);
80 VTK_ABI_NAMESPACE_END
81 #ifdef _MSC_VER
82 #pragma warning(pop)
83 #endif
84 #endif // VTK_CONSTANT_IMPLICIT_BACKEND_TEMPLATE_EXTERN
85
86 #endif
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkConstantImplicitBackend
A utility structure serving as a backend for constant implicit arrays.
Definition: vtkConstantImplicitBackend.h:36
vtkConstantImplicitBackend::operator()
ValueType operator()(int vtkNotUsed(index)) const
The main call method for the backend.
Definition: vtkConstantImplicitBackend.h:52
vtkConstantImplicitBackend::vtkConstantImplicitBackend
vtkConstantImplicitBackend(ValueType val)
A non-trivially contructible constructor.
Definition: vtkConstantImplicitBackend.h:42
vtkConstantImplicitBackend::Value
const ValueType Value
The constant value stored in the backend.
Definition: vtkConstantImplicitBackend.h:57
vtkCompiler.h
vtkExternTemplateMacro
vtkExternTemplateMacro(extern template struct VTKCOMMONCORE_EXPORT vtkConstantImplicitBackend)
vtkType.h