VTK  9.5.20251121
vtkConstantArray.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 vtkConstantArray_h
5#define vtkConstantArray_h
6
7#ifdef VTK_CONSTANT_ARRAY_INSTANTIATING
8#define VTK_IMPLICIT_VALUERANGE_INSTANTIATING
9#include "vtkDataArrayPrivate.txx"
10#endif
11
12#include "vtkCommonCoreModule.h" // for export macro
13#include "vtkConstantImplicitBackend.h" // for the array backend
14#include "vtkImplicitArray.h"
15
16#ifdef VTK_CONSTANT_ARRAY_INSTANTIATING
17#undef VTK_IMPLICIT_VALUERANGE_INSTANTIATING
18#endif
19
30
31VTK_ABI_NAMESPACE_BEGIN
32template <typename T>
35VTK_ABI_NAMESPACE_END
36
37#endif // vtkConstantArray_h
38
39#ifdef VTK_CONSTANT_ARRAY_INSTANTIATING
40
41#define VTK_INSTANTIATE_CONSTANT_ARRAY(ValueType) \
42 VTK_ABI_NAMESPACE_BEGIN \
43 template class VTKCOMMONCORE_EXPORT \
44 vtkImplicitArray<vtkConstantImplicitBackend<ValueType>, vtkArrayTypes::VTK_CONSTANT_ARRAY>; \
45 VTK_ABI_NAMESPACE_END \
46 namespace vtkDataArrayPrivate \
47 { \
48 VTK_ABI_NAMESPACE_BEGIN \
49 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE( \
50 VTK_WRAP_TEMPLATE( \
51 vtkImplicitArray<vtkConstantImplicitBackend<ValueType>, vtkArrayTypes::VTK_CONSTANT_ARRAY>), \
52 double) \
53 VTK_ABI_NAMESPACE_END \
54 }
55#elif defined(VTK_USE_EXTERN_TEMPLATE)
56#ifndef VTK_CONSTANT_ARRAY_TEMPLATE_EXTERN
57#define VTK_CONSTANT_ARRAY_TEMPLATE_EXTERN
58#ifdef _MSC_VER
59#pragma warning(push)
60// The following is needed when the vtkConstantArray is declared
61// dllexport and is used from another class in vtkCommonCore
62#pragma warning(disable : 4910) // extern and dllexport incompatible
63#endif
64VTK_ABI_NAMESPACE_BEGIN
66 extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, vtkConstantImplicitBackend,
68#ifdef _MSC_VER
69#pragma warning(pop)
70#endif
71VTK_ABI_NAMESPACE_END
72#endif // VTK_CONSTANT_ARRAY_TEMPLATE_EXTERN
73// The following clause is only for MSVC 2008 and 2010
74#elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
75#pragma warning(push)
76// C4091: 'extern ' : ignored on left of 'int' when no variable is declared
77#pragma warning(disable : 4091)
78
79// Compiler-specific extension warning.
80#pragma warning(disable : 4231)
81
82// We need to disable warning 4910 and do an extern dllexport
83// anyway. When deriving new arrays from an
84// instantiation of this template the compiler does an explicit
85// instantiation of the base class. From outside the vtkCommon
86// library we block this using an extern dllimport instantiation.
87// For classes inside vtkCommon we should be able to just do an
88// extern instantiation, but VS 2008 complains about missing
89// definitions. We cannot do an extern dllimport inside vtkCommon
90// since the symbols are local to the dll. An extern dllexport
91// seems to be the only way to convince VS 2008 to do the right
92// thing, so we just disable the warning.
93#pragma warning(disable : 4910) // extern and dllexport incompatible
94
95// Use an "extern explicit instantiation" to give the class a DLL
96// interface. This is a compiler-specific extension.
97VTK_ABI_NAMESPACE_BEGIN
99 extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, vtkConstantImplicitBackend,
101
102#pragma warning(pop)
103
104VTK_ABI_NAMESPACE_END
105#endif
A read only array class that wraps an implicit function from integers to any value type supported by ...
A utility structure serving as a backend for constant implicit arrays.
vtkImplicitArray< vtkConstantImplicitBackend< T >, vtkArrayTypes::VTK_CONSTANT_ARRAY > vtkConstantArray
A utility alias for wrapping constant functions in implicit arrays.
#define vtkInstantiateSecondOrderWithParameterTemplateMacro(decl0, decl1, par)
Definition vtkType.h:445
@ VTK_CONSTANT_ARRAY
Definition vtkType.h:93
#define vtkExternSecondOrderWithParameterTemplateMacro(decl0, decl1, par)
Definition vtkType.h:495