VTK  9.5.20250912
vtkStridedImplicitBackend.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#ifndef vtkStridedImplicitBackend_h
4#define vtkStridedImplicitBackend_h
5
20#include "vtkCommonCoreModule.h"
21
22#include "vtkType.h"
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkIdList;
26template <typename ValueType>
27class VTKCOMMONCORE_EXPORT vtkStridedImplicitBackend final
28{
29public:
31
43 const ValueType* buffer, vtkIdType stride, int components, vtkIdType offset);
44 vtkStridedImplicitBackend(const ValueType* buffer, vtkIdType stride, int components);
45 vtkStridedImplicitBackend(const ValueType* buffer, vtkIdType stride);
48
54 ValueType operator()(vtkIdType idx) const;
55
60 void mapTuple(vtkIdType tupleIdx, ValueType* tuple) const;
61
66 ValueType mapComponent(vtkIdType tupleIdx, int compIdx) const;
67
68private:
69 const ValueType* Buffer = nullptr;
70 vtkIdType Stride = 1;
71 vtkIdType Offset = 0;
72 int NumberOfComponents = 1;
73};
74VTK_ABI_NAMESPACE_END
75
76#endif // vtkStridedImplicitBackend_h
77
78#if defined(VTK_STRIDED_BACKEND_INSTANTIATING)
79
80#define VTK_INSTANTIATE_STRIDED_BACKEND(ValueType) \
81 VTK_ABI_NAMESPACE_BEGIN \
82 template class VTKCOMMONCORE_EXPORT vtkStridedImplicitBackend<ValueType>; \
83 VTK_ABI_NAMESPACE_END
84
85#elif defined(VTK_USE_EXTERN_TEMPLATE)
86
87#ifndef VTK_STRIDED_BACKEND_TEMPLATE_EXTERN
88#define VTK_STRIDED_BACKEND_TEMPLATE_EXTERN
89#ifdef _MSC_VER
90#pragma warning(push)
91#pragma warning(disable : 4910) // extern and dllexport incompatible
92#endif
93VTK_ABI_NAMESPACE_BEGIN
94vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkStridedImplicitBackend);
95VTK_ABI_NAMESPACE_END
96#ifdef _MSC_VER
97#pragma warning(pop)
98#endif
99#endif // VTK_STRIDED_IMPLICIT_BACKEND_TEMPLATE_EXTERN
100
101#endif
list of point or cell ids
Definition vtkIdList.h:133
A backend for the vtkImplicitArray framework to give a strided view on a buffer.
vtkStridedImplicitBackend(const ValueType *buffer, vtkIdType stride, int components, vtkIdType offset)
Constructors.
ValueType mapComponent(vtkIdType tupleIdx, int compIdx) const
Return the specified component value.
void mapTuple(vtkIdType tupleIdx, ValueType *tuple) const
Fill tuple with the content of the tupleIdx of the array.
ValueType operator()(vtkIdType idx) const
Return the value at the given flat idx.
vtkStridedImplicitBackend(const ValueType *buffer, vtkIdType stride, int components)
Constructors.
vtkStridedImplicitBackend(const ValueType *buffer, vtkIdType stride)
Constructors.
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
Definition vtkType.h:428
int vtkIdType
Definition vtkType.h:333