VTK  9.6.20260325
vtkCompositeImplicitBackend.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 vtkCompositeImplicitBackend_h
5#define vtkCompositeImplicitBackend_h
6
41#include "vtkCommonCoreModule.h"
42#include "vtkCompiler.h" // For VTK_USE_EXTERN_TEMPLATE
43#include "vtkType.h" // For vtkExternTemplateMacro
44
45#include <memory>
46#include <vector>
47
48VTK_ABI_NAMESPACE_BEGIN
49class vtkDataArray;
51template <typename ValueType>
52class VTKCOMMONCORE_EXPORT vtkCompositeImplicitBackend final
53{
54public:
60 vtkCompositeImplicitBackend(const std::vector<vtkDataArray*>& arrays);
63
71 ValueType operator()(vtkIdType idx) const;
72
78 unsigned long getMemorySize() const;
79
84
89
95
96protected:
97 struct Internals;
98 std::unique_ptr<Internals> Internal;
99};
100VTK_ABI_NAMESPACE_END
101
102#endif // vtkCompositeImplicitBackend_h
103
104#if defined(VTK_COMPOSITE_BACKEND_INSTANTIATING)
105
106#define VTK_INSTANTIATE_COMPOSITE_BACKEND(ValueType) \
107 VTK_ABI_NAMESPACE_BEGIN \
108 template class VTKCOMMONCORE_EXPORT vtkCompositeImplicitBackend<ValueType>; \
109 VTK_ABI_NAMESPACE_END
110
111#elif defined(VTK_USE_EXTERN_TEMPLATE)
112
113#ifndef VTK_COMPOSITE_BACKEND_TEMPLATE_EXTERN
114#define VTK_COMPOSITE_BACKEND_TEMPLATE_EXTERN
115#ifdef _MSC_VER
116#pragma warning(push)
117#pragma warning(disable : 4910) // extern and dllexport incompatible
118#endif
119VTK_ABI_NAMESPACE_BEGIN
120vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkCompositeImplicitBackend);
121VTK_ABI_NAMESPACE_END
122#ifdef _MSC_VER
123#pragma warning(pop)
124#endif
125#endif // VTK_COMPOSITE_IMPLICIT_BACKEND_TEMPLATE_EXTERN
126
127#endif
A utility structure serving as a backend for composite arrays: an array composed of multiple arrays c...
vtkIdType GetOffset(vtkIdType idx) const
Get the tuple offset of the array at the given index.
ValueType operator()(vtkIdType idx) const
Indexing operator for the composite of the two arrays respecting the vtkImplicitArray expectations.
vtkCompositeImplicitBackend(const std::vector< vtkDataArray * > &arrays)
Constructor for the backend.
std::unique_ptr< Internals > Internal
vtkIdType GetNumberOfArrays() const
Get the number of original arrays composing this backend.
unsigned long getMemorySize() const
Returns the smallest integer memory size in KiB needed to store the array.
vtkDataArray * GetArray(vtkIdType idx) const
Get the original array at the given index.
vtkCompositeImplicitBackend(vtkDataArrayCollection *arrays)
maintain an ordered list of dataarray objects
#define vtkDataArray
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
Definition vtkType.h:458
int vtkIdType
Definition vtkType.h:363