VTK  9.3.20240907
vtkCompositeArray.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 vtkCompositeArray_h
5#define vtkCompositeArray_h
6
7#ifdef VTK_COMPOSITE_ARRAY_INSTANTIATING
8#define VTK_IMPLICIT_VALUERANGE_INSTANTIATING
9#include "vtkDataArrayPrivate.txx"
10#endif
11
12#include "vtkCommonCoreModule.h" // for export macro
13#include "vtkCompositeImplicitBackend.h" // for the array backend
14#include "vtkImplicitArray.h"
15
16#ifdef VTK_COMPOSITE_ARRAY_INSTANTIATING
17#undef VTK_IMPLICIT_VALUERANGE_INSTANTIATING
18#endif
19
20#include <vector>
21
50VTK_ABI_NAMESPACE_BEGIN
51class vtkDataArray;
52template <typename T>
54VTK_ABI_NAMESPACE_END
55
56namespace vtk
57{
58VTK_ABI_NAMESPACE_BEGIN
59template <typename T>
69 const std::vector<vtkDataArray*>& arrays);
70VTK_ABI_NAMESPACE_END
71}
72
73#endif // vtkCompositeArray_h
74
75#ifdef VTK_COMPOSITE_ARRAY_INSTANTIATING
76// The instantiation is separated in two functions because the .txx includes vtkArrayDispatch.h
77// which when Dispatching is enabled, it instantiates a class with a value type, before exporting it
78#define VTK_INSTANTIATE_COMPOSITE_ARRAY(ValueType) \
79 VTK_ABI_NAMESPACE_BEGIN \
80 template class VTKCOMMONCORE_EXPORT vtkImplicitArray<vtkCompositeImplicitBackend<ValueType>>; \
81 VTK_ABI_NAMESPACE_END \
82 namespace vtkDataArrayPrivate \
83 { \
84 VTK_ABI_NAMESPACE_BEGIN \
85 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE( \
86 vtkImplicitArray<vtkCompositeImplicitBackend<ValueType>>, double) \
87 VTK_ABI_NAMESPACE_END \
88 }
89#define VTK_INSTANTIATE_COMPOSITE_ARRAY_FUNCTIONS(ValueType) \
90 namespace vtk \
91 { \
92 VTK_ABI_NAMESPACE_BEGIN \
93 template VTKCOMMONCORE_EXPORT \
94 vtkSmartPointer<vtkImplicitArray<vtkCompositeImplicitBackend<ValueType>>> \
95 ConcatenateDataArrays(const std::vector<vtkDataArray*>& arrays); \
96 VTK_ABI_NAMESPACE_END \
97 }
98
99#elif defined(VTK_USE_EXTERN_TEMPLATE)
100#ifndef VTK_COMPOSITE_ARRAY_TEMPLATE_EXTERN
101#define VTK_COMPOSITE_ARRAY_TEMPLATE_EXTERN
102#ifdef _MSC_VER
103#pragma warning(push)
104// The following is needed when the vtkCompositeArray is declared
105// dllexport and is used from another class in vtkCommonCore
106#pragma warning(disable : 4910) // extern and dllexport incompatible
107#endif
108VTK_ABI_NAMESPACE_BEGIN
110 extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, vtkCompositeImplicitBackend);
111#ifdef _MSC_VER
112#pragma warning(pop)
113#endif
114VTK_ABI_NAMESPACE_END
115#endif // VTK_COMPOSITE_ARRAY_TEMPLATE_EXTERN
116// The following clause is only for MSVC 2008 and 2010
117#elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
118#pragma warning(push)
119// C4091: 'extern ' : ignored on left of 'int' when no variable is declared
120#pragma warning(disable : 4091)
121
122// Compiler-specific extension warning.
123#pragma warning(disable : 4231)
124
125// We need to disable warning 4910 and do an extern dllexport
126// anyway. When deriving new arrays from an
127// instantiation of this template the compiler does an explicit
128// instantiation of the base class. From outside the vtkCommon
129// library we block this using an extern dllimport instantiation.
130// For classes inside vtkCommon we should be able to just do an
131// extern instantiation, but VS 2008 complains about missing
132// definitions. We cannot do an extern dllimport inside vtkCommon
133// since the symbols are local to the dll. An extern dllexport
134// seems to be the only way to convince VS 2008 to do the right
135// thing, so we just disable the warning.
136#pragma warning(disable : 4910) // extern and dllexport incompatible
137
138// Use an "extern explicit instantiation" to give the class a DLL
139// interface. This is a compiler-specific extension.
140VTK_ABI_NAMESPACE_BEGIN
142 extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, vtkCompositeImplicitBackend);
143
144#pragma warning(pop)
145
146VTK_ABI_NAMESPACE_END
147#endif
A utility structure serving as a backend for composite arrays: an array composed of multiple arrays c...
abstract superclass for arrays of numeric data
A read only array class that wraps an implicit function from integers to any value type supported by ...
Hold a reference to a vtkObjectBase instance.
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
vtkSmartPointer< vtkCompositeArray< T > > ConcatenateDataArrays(const std::vector< vtkDataArray * > &arrays)
#define vtkInstantiateSecondOrderTemplateMacro(decl0, decl1)
Definition vtkType.h:378
#define vtkExternSecondOrderTemplateMacro(decl0, decl1)
Definition vtkType.h:411