VTK  9.6.20260227
vtkArrayIteratorTemplate.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
13
14#ifndef vtkArrayIteratorTemplate_h
15#define vtkArrayIteratorTemplate_h
16
17#include "vtkArrayIterator.h"
18#include "vtkCommonCoreModule.h" // For export macro
19#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
20
21#include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
22#include "vtkStdString.h" // For template instantiation
23#include "vtkVariant.h" // For template instantiation
24
25VTK_ABI_NAMESPACE_BEGIN
26template <class T>
27class VTK_DEPRECATED_IN_9_7_0("Use vtkArrayDispatch") VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate
28 : public vtkArrayIterator
29{
30public:
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
42 void Initialize(vtkAbstractArray* array) override;
43
47 vtkAbstractArray* GetArray() { return this->Array; }
48
53
57 T& GetValue(vtkIdType id) { return this->Pointer[id]; }
58
64 void SetValue(vtkIdType id, T value) { this->Pointer[id] = value; }
65
70
75
80
84 int GetDataType() const override;
85
89 int GetDataTypeSize() const;
90
94 typedef T ValueType;
95
96protected:
99
101
102private:
104 void operator=(const vtkArrayIteratorTemplate&) = delete;
105
106 void SetArray(vtkAbstractArray*);
107 vtkAbstractArray* Array;
108};
109
110#ifdef VTK_USE_EXTERN_TEMPLATE
111#ifndef vtkArrayIteratorTemplateInstantiate_cxx
112#ifdef _MSC_VER
113#pragma warning(push)
114// The following is needed when the vtkArrayIteratorTemplate is declared
115// dllexport and is used from another class in vtkCommonCore
116#pragma warning(disable : 4910) // extern and dllexport incompatible
117#endif
118vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate);
119extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkStdString>;
120extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkVariant>;
121#ifdef _MSC_VER
122#pragma warning(pop)
123#endif
124#endif
125#endif // VTK_USE_EXTERN_TEMPLATE
126
127VTK_ABI_NAMESPACE_END
128#endif
129
130// VTK-HeaderTest-Exclude: vtkArrayIteratorTemplate.h
Abstract superclass for all arrays.
Implementation template for a array iterator.
T ValueType
This is the data type for the value.
int GetNumberOfComponents() const
Must be called only after Initialize.
vtkIdType GetNumberOfTuples() const
Must be called only after Initialize.
void Initialize(vtkAbstractArray *array) override
Set the array this iterator will iterate over.
static vtkArrayIteratorTemplate< T > * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractArray * GetArray()
Get the array.
~vtkArrayIteratorTemplate() override
int GetDataType() const override
Get the data type from the underlying array.
void SetValue(vtkIdType id, T value)
Sets the value at the index.
T & GetValue(vtkIdType id)
Must be called only after Initialize.
T * GetTuple(vtkIdType id)
Must be called only after Initialize.
vtkIdType GetNumberOfValues() const
Must be called only after Initialize.
int GetDataTypeSize() const
Get the data type size from the underlying array.
vtkTemplateTypeMacro(vtkArrayIteratorTemplate< T >, vtkArrayIterator)
a simple class to control print indentation
Definition vtkIndent.h:108
#define VTK_DEPRECATED_IN_9_7_0(reason)
int vtkIdType
Definition vtkType.h:363
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
Definition vtkType.h:411