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