VTK
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 "vtkCommonCoreModule.h" // For export macro
30 #include "vtkArrayIterator.h"
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 
58 
62  T* GetTuple(vtkIdType id);
63 
68  { return this->Pointer[id]; }
69 
75  void SetValue(vtkIdType id, T value)
76  {
77  this->Pointer[id] = value;
78  }
79 
83  vtkIdType GetNumberOfTuples();
84 
88  vtkIdType GetNumberOfValues();
89 
93  int GetNumberOfComponents();
94 
98  int GetDataType() override;
99 
103  int GetDataTypeSize();
104 
108  typedef T ValueType;
109 
110 protected:
112  ~vtkArrayIteratorTemplate() override;
113 
115 private:
117  void operator=(const vtkArrayIteratorTemplate&) = delete;
118 
119  void SetArray(vtkAbstractArray*);
120  vtkAbstractArray* Array;
121 };
122 
123 #ifdef VTK_USE_EXTERN_TEMPLATE
124 #ifndef vtkArrayIteratorTemplateInstantiate_cxx
125 #ifdef _MSC_VER
126 #pragma warning (push)
127 // The following is needed when the vtkArrayIteratorTemplate is declared
128 // dllexport and is used from another class in vtkCommonCore
129 #pragma warning (disable: 4910) // extern and dllexport incompatible
130 #endif
132  extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
133 extern template class VTKCOMMONCORE_EXPORT
135 extern template class VTKCOMMONCORE_EXPORT
137 extern template class VTKCOMMONCORE_EXPORT
139 #ifdef _MSC_VER
140 #pragma warning (pop)
141 #endif
142 #endif
143 #endif // VTK_USE_EXTERN_TEMPLATE
144 
145 #endif
146 
147 // VTK-HeaderTest-Exclude: vtkArrayIteratorTemplate.h
T ValueType
This is the data type for the value.
virtual int GetDataType()=0
Get the data type from the underlying array.
Abstract superclass for all arrays.
int vtkIdType
Definition: vtkType.h:345
Implementation template for a array iterator.
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetValue(vtkIdType id, T value)
Sets the value at the index.
T & GetValue(vtkIdType id)
Must be called only after Initialize.
Abstract superclass to iterate over elements in an vtkAbstractArray.
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
Definition: vtkType.h:393
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.