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:
41  vtkTemplateTypeMacro(vtkArrayIteratorTemplate<T>, vtkArrayIterator);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
51  void Initialize(vtkAbstractArray* array) override;
52 
56  vtkAbstractArray* GetArray() { return this->Array; }
57 
61  T* GetTuple(vtkIdType id);
62 
66  T& GetValue(vtkIdType id) { return this->Pointer[id]; }
67 
73  void SetValue(vtkIdType id, T value) { this->Pointer[id] = value; }
74 
78  vtkIdType GetNumberOfTuples();
79 
83  vtkIdType GetNumberOfValues();
84 
88  int GetNumberOfComponents();
89 
93  int GetDataType() const override;
94 
98  int GetDataTypeSize() const;
99 
103  typedef T ValueType;
104 
105 protected:
107  ~vtkArrayIteratorTemplate() override;
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
vtkStdString.h
vtkArrayIterator::Initialize
virtual void Initialize(vtkAbstractArray *array)=0
Set the array this iterator will iterate over.
vtkVariant.h
vtkX3D::value
@ value
Definition: vtkX3D.h:226
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkArrayIterator.h
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkUnicodeString.h
vtkArrayIteratorTemplate
Implementation template for a array iterator.
Definition: vtkArrayIteratorTemplate.h:37
vtkArrayIteratorTemplate::Pointer
T * Pointer
Definition: vtkArrayIteratorTemplate.h:109
vtkArrayIterator::GetDataType
virtual int GetDataType() const =0
Get the data type from the underlying array.
vtkArrayIteratorTemplate::GetArray
vtkAbstractArray * GetArray()
Get the array.
Definition: vtkArrayIteratorTemplate.h:56
vtkArrayIterator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkArrayIteratorTemplate::SetValue
void SetValue(vtkIdType id, T value)
Sets the value at the index.
Definition: vtkArrayIteratorTemplate.h:73
vtkArrayIteratorTemplate::ValueType
T ValueType
This is the data type for the value.
Definition: vtkArrayIteratorTemplate.h:103
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:75
vtkInstantiateTemplateMacro
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
Definition: vtkType.h:384
vtkArrayIteratorTemplate::GetValue
T & GetValue(vtkIdType id)
Must be called only after Initialize.
Definition: vtkArrayIteratorTemplate.h:66
vtkArrayIterator
Abstract superclass to iterate over elements in an vtkAbstractArray.
Definition: vtkArrayIterator.h:49