VTK  9.1.0
vtkArrayIteratorTemplate.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkArrayIteratorTemplate.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
26#ifndef vtkArrayIteratorTemplate_h
27#define vtkArrayIteratorTemplate_h
28
29#include "vtkArrayIterator.h"
30#include "vtkCommonCoreModule.h" // For export macro
31
32#include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
33#include "vtkStdString.h" // For template instantiation
34#include "vtkUnicodeString.h" // For template instantiation
35#include "vtkVariant.h" // For template instantiation
36
37template <class T>
38class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator
39{
40public:
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
52 void Initialize(vtkAbstractArray* array) override;
53
57 vtkAbstractArray* GetArray() { return this->Array; }
58
63
67 T& GetValue(vtkIdType id) { return this->Pointer[id]; }
68
74 void SetValue(vtkIdType id, T value) { this->Pointer[id] = value; }
75
80
85
90
94 int GetDataType() const override;
95
99 int GetDataTypeSize() const;
100
104 typedef T ValueType;
105
106protected:
109
111
112private:
114 void operator=(const vtkArrayIteratorTemplate&) = delete;
115
116 void SetArray(vtkAbstractArray*);
117 vtkAbstractArray* Array;
118};
119
120#ifdef VTK_USE_EXTERN_TEMPLATE
121#ifndef vtkArrayIteratorTemplateInstantiate_cxx
122#ifdef _MSC_VER
123#pragma warning(push)
124// The following is needed when the vtkArrayIteratorTemplate is declared
125// dllexport and is used from another class in vtkCommonCore
126#pragma warning(disable : 4910) // extern and dllexport incompatible
127#endif
128vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate);
129extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkStdString>;
130extern template class VTK_DEPRECATED_IN_9_1_0("Use vtkArrayIteratorTemplate<vtkStdString>")
131 VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkUnicodeString>;
132extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkVariant>;
133#ifdef _MSC_VER
134#pragma warning(pop)
135#endif
136#endif
137#endif // VTK_USE_EXTERN_TEMPLATE
138
139#endif
140
141// 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)
Abstract superclass to iterate over elements in an vtkAbstractArray.
a simple class to control print indentation
Definition: vtkIndent.h:113
String class that stores Unicode text.
A atomic type representing the union of many types.
Definition: vtkVariant.h:145
@ value
Definition: vtkX3D.h:226
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
#define VTK_DEPRECATED_IN_9_1_0(reason)
int vtkIdType
Definition: vtkType.h:332