VTK  9.4.20241217
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
33VTK_ABI_NAMESPACE_BEGIN
34template <typename ValueType>
35struct VTKCOMMONCORE_EXPORT vtkConstantImplicitBackend final
36{
43 : Value(val)
44 {
45 }
46
52 ValueType operator()(vtkIdType vtkNotUsed(index)) const { return this->Value; }
53
57 const ValueType Value;
58};
59VTK_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
78VTK_ABI_NAMESPACE_BEGIN
79vtkExternTemplateMacro(extern template struct VTKCOMMONCORE_EXPORT vtkConstantImplicitBackend);
80VTK_ABI_NAMESPACE_END
81#ifdef _MSC_VER
82#pragma warning(pop)
83#endif
84#endif // VTK_CONSTANT_IMPLICIT_BACKEND_TEMPLATE_EXTERN
85
86#endif
A utility structure serving as a backend for constant implicit arrays.
ValueType operator()(vtkIdType vtkNotUsed(index)) const
The main call method for the backend.
vtkConstantImplicitBackend(ValueType val)
A non-trivially contructible constructor.
const ValueType Value
The constant value stored in the backend.
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
Definition vtkType.h:410
int vtkIdType
Definition vtkType.h:315