VTK  9.0.1
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 "vtkStdString.h" // For template instantiation
33 #include "vtkUnicodeString.h" // For template instantiation
34 #include "vtkVariant.h" // For template instantiation
35 
36 template <class T>
37 class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator
38 {
39 public:
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
51  void Initialize(vtkAbstractArray* array) override;
52 
56  vtkAbstractArray* GetArray() { return this->Array; }
57 
62 
66  T& GetValue(vtkIdType id) { return this->Pointer[id]; }
67 
73  void SetValue(vtkIdType id, T value) { this->Pointer[id] = value; }
74 
79 
84 
89 
93  int GetDataType() const override;
94 
98  int GetDataTypeSize() const;
99 
103  typedef T ValueType;
104 
105 protected:
108 
110 
111 private:
113  void operator=(const vtkArrayIteratorTemplate&) = delete;
114 
115  void SetArray(vtkAbstractArray*);
116  vtkAbstractArray* Array;
117 };
118 
119 #ifdef VTK_USE_EXTERN_TEMPLATE
120 #ifndef vtkArrayIteratorTemplateInstantiate_cxx
121 #ifdef _MSC_VER
122 #pragma warning(push)
123 // The following is needed when the vtkArrayIteratorTemplate is declared
124 // dllexport and is used from another class in vtkCommonCore
125 #pragma warning(disable : 4910) // extern and dllexport incompatible
126 #endif
127 vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate);
128 extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkStdString>;
129 extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkUnicodeString>;
130 extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkVariant>;
131 #ifdef _MSC_VER
132 #pragma warning(pop)
133 #endif
134 #endif
135 #endif // VTK_USE_EXTERN_TEMPLATE
136 
137 #endif
138 
139 // 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.
void Initialize(vtkAbstractArray *array) override
Set the array this iterator will iterate over.
vtkIdType GetNumberOfValues()
Must be called only after Initialize.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractArray * GetArray()
Get the array.
static vtkArrayIteratorTemplate< T > * New()
~vtkArrayIteratorTemplate() override
int GetDataType() const override
Get the data type from the underlying array.
T & GetValue(vtkIdType id)
Must be called only after Initialize.
void SetValue(vtkIdType id, T value)
Sets the value at the index.
T * GetTuple(vtkIdType id)
Must be called only after Initialize.
int GetDataTypeSize() const
Get the data type size from the underlying array.
int GetNumberOfComponents()
Must be called only after Initialize.
vtkIdType GetNumberOfTuples()
Must be called only after Initialize.
vtkTemplateTypeMacro(vtkArrayIteratorTemplate< T >, vtkArrayIterator)
Abstract superclass to iterate over elements in an vtkAbstractArray.
a simple class to control print indentation
Definition: vtkIndent.h:34
@ value
Definition: vtkX3D.h:226
int vtkIdType
Definition: vtkType.h:338
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
Definition: vtkType.h:384