VTK  9.4.20250113
vtkDataObjectImplicitBackendInterface.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
4#ifndef vtkDataObjectImplicitBackendInterface_h
5#define vtkDataObjectImplicitBackendInterface_h
6
7#include "vtkCommonDataModelModule.h"
8
10#include "vtkDataArrayMeta.h"
11#include "vtkSmartPointer.h" // for internal member
12#include "vtkWeakPointer.h" // for internal member
13
58VTK_ABI_NAMESPACE_BEGIN
59
60class vtkDataObject;
61class vtkObject;
62
63template <typename ValueType>
64struct VTKCOMMONDATAMODEL_EXPORT vtkDataObjectImplicitBackendInterface
65{
67 vtkDataObject* dataobject, const std::string& arrayName, int attributeType);
68
70
78 ValueType operator()(vtkIdType idx) const;
79
80protected:
85 void OnDataObjectDeleted(vtkObject* caller, unsigned long eventId, void* calldata);
86
91 virtual ValueType GetValueFromDataObject(vtkIdType idx) const = 0;
92
96 vtkDataObject* GetDataObject() { return this->DataObject; }
97
98private:
103 vtkDataArray* GetArray();
104
106
108 std::string ArrayName;
109 int AttributeType;
110};
111
112VTK_ABI_NAMESPACE_END
113#endif
114
115#if defined(VTK_DATAOBJECT_BACKEND_INSTANTIATING)
116
117#define VTK_INSTANTIATE_DATAOBJECT_BACKEND(ValueType) \
118 VTK_ABI_NAMESPACE_BEGIN \
119 template struct VTKCOMMONDATAMODEL_EXPORT vtkDataObjectImplicitBackendInterface<ValueType>; \
120 VTK_ABI_NAMESPACE_END
121
122#elif defined(VTK_USE_EXTERN_TEMPLATE)
123
124#ifndef VTK_DATAOBJECT_BACKEND_TEMPLATE_EXTERN
125#define VTK_DATAOBJECT_BACKEND_TEMPLATE_EXTERN
126#ifdef _MSC_VER
127#pragma warning(push)
128#pragma warning(disable : 4910) // extern and dllexport incompatible
129#endif
130VTK_ABI_NAMESPACE_BEGIN
132 extern template struct VTKCOMMONDATAMODEL_EXPORT vtkDataObjectImplicitBackendInterface);
133VTK_ABI_NAMESPACE_END
134#ifdef _MSC_VER
135#pragma warning(pop)
136#endif
137#endif // VTK_DATAOBJECT_IMPLICIT_BACKEND_TEMPLATE_EXTERN
138
139#endif
abstract superclass for arrays of numeric data
general representation of visualization data
abstract base class for most VTK objects
Definition vtkObject.h:162
Hold a reference to a vtkObjectBase instance.
a weak reference to a vtkObject.
A utility structure that can be used as a base for implicit array backend that relies on a vtkDataObj...
void OnDataObjectDeleted(vtkObject *caller, unsigned long eventId, void *calldata)
Callback to call when DataObject is destroyed.
ValueType operator()(vtkIdType idx) const
Get the value at given index.
vtkDataObjectImplicitBackendInterface(vtkDataObject *dataobject, const std::string &arrayName, int attributeType)
vtkDataObject * GetDataObject()
Get the internal dataobject.
virtual ValueType GetValueFromDataObject(vtkIdType idx) const =0
Return the actual value for given index.
This file contains a variety of metaprogramming constructs for working with vtkDataArrays.
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
Definition vtkType.h:410
int vtkIdType
Definition vtkType.h:315