VTK  9.3.1
vtkStdFunctionArray.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 vtkStdFunctionArray_h
5 #define vtkStdFunctionArray_h
6 
7 #ifdef VTK_STD_FUNCTION_ARRAY_INSTANTIATING
8 #define VTK_IMPLICIT_VALUERANGE_INSTANTIATING
9 #include "vtkDataArrayPrivate.txx"
10 #endif
11 
12 #include "vtkCommonCoreModule.h" // for export macro
13 #include "vtkImplicitArray.h"
14 
15 #ifdef VTK_STD_FUNCTION_ARRAY_INSTANTIATING
16 #undef VTK_IMPLICIT_VALUERANGE_INSTANTIATING
17 #endif
18 
19 #include <functional>
20 
37 VTK_ABI_NAMESPACE_BEGIN
38 template <typename T>
40 VTK_ABI_NAMESPACE_END
41 
42 #endif // vtkStdFunctionArray_h
43 
44 #ifdef VTK_STD_FUNCTION_ARRAY_INSTANTIATING
45 
46 #define VTK_INSTANTIATE_STD_FUNCTION_ARRAY(ValueType) \
47  VTK_ABI_NAMESPACE_BEGIN \
48  template class VTKCOMMONCORE_EXPORT vtkImplicitArray<std::function<ValueType(int)>>; \
49  VTK_ABI_NAMESPACE_END \
50  namespace vtkDataArrayPrivate \
51  { \
52  VTK_ABI_NAMESPACE_BEGIN \
53  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkImplicitArray<std::function<ValueType(int)>>, double) \
54  VTK_ABI_NAMESPACE_END \
55  }
56 #elif defined(VTK_USE_EXTERN_TEMPLATE)
57 #ifndef VTK_STD_FUNCTION_ARRAY_TEMPLATE_EXTERN
58 #define VTK_STD_FUNCTION_ARRAY_TEMPLATE_EXTERN
59 #ifdef _MSC_VER
60 #pragma warning(push)
61 // The following is needed when the vtkAffineArray is declared
62 // dllexport and is used from another class in vtkCommonCore
63 #pragma warning(disable : 4910) // extern and dllexport incompatible
64 #endif
65 VTK_ABI_NAMESPACE_BEGIN
67  extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, std::function, int);
68 #ifdef _MSC_VER
69 #pragma warning(pop)
70 #endif
71 VTK_ABI_NAMESPACE_END
72 #endif // VTK_STD_FUNCTION_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.
97 VTK_ABI_NAMESPACE_BEGIN
99  extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, std::function, int);
100 
101 #pragma warning(pop)
102 
103 VTK_ABI_NAMESPACE_END
104 #endif
vtkExternStdFunctionTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, std::function, int)
A read only array class that wraps an implicit function from integers to any value type supported by ...
#define vtkInstantiateStdFunctionTemplateMacro(decl0, decl1, delc2)
Definition: vtkType.h:393