VTK  9.0.20210121
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 
37 template <class T>
38 class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator
39 {
40 public:
42  vtkTemplateTypeMacro(vtkArrayIteratorTemplate<T>, vtkArrayIterator);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
52  void Initialize(vtkAbstractArray* array) override;
53 
57  vtkAbstractArray* GetArray() { return this->Array; }
58 
62  T* GetTuple(vtkIdType id);
63 
67  T& GetValue(vtkIdType id) { return this->Pointer[id]; }
68 
74  void SetValue(vtkIdType id, T value) { this->Pointer[id] = value; }
75 
79  vtkIdType GetNumberOfTuples();
80 
84  vtkIdType GetNumberOfValues();
85 
89  int GetNumberOfComponents();
90 
94  int GetDataType() const override;
95 
99  int GetDataTypeSize() const;
100 
104  typedef T ValueType;
105 
106 protected:
108  ~vtkArrayIteratorTemplate() override;
109 
111 
112 private:
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
128 vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate);
129 extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkStdString>;
130 extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkUnicodeString>;
131 extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkVariant>;
132 #ifdef _MSC_VER
133 #pragma warning(pop)
134 #endif
135 #endif
136 #endif // VTK_USE_EXTERN_TEMPLATE
137 
138 #endif
139 
140 // 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
Definition: vtkX3D.h:226
vtkIdType
int vtkIdType
Definition: vtkType.h:330
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:38
vtkArrayIteratorTemplate::Pointer
T * Pointer
Definition: vtkArrayIteratorTemplate.h:110
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:57
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:74
vtkArrayIteratorTemplate::ValueType
T ValueType
This is the data type for the value.
Definition: vtkArrayIteratorTemplate.h:104
vtkCompiler.h
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:75
vtkArrayIteratorTemplate::GetValue
T & GetValue(vtkIdType id)
Must be called only after Initialize.
Definition: vtkArrayIteratorTemplate.h:67
vtkInstantiateTemplateMacro
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
vtkArrayIterator
Abstract superclass to iterate over elements in an vtkAbstractArray.
Definition: vtkArrayIterator.h:49