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 =========================================================================*/
29 #ifndef vtkArrayIteratorTemplate_h
30 #define vtkArrayIteratorTemplate_h
31 
32 #include "vtkCommonCoreModule.h" // For export macro
33 #include "vtkArrayIterator.h"
34 
35 #include "vtkStdString.h" // For template instantiation
36 #include "vtkUnicodeString.h" // For template instantiation
37 #include "vtkVariant.h" // For template instantiation
38 
39 template <class T>
40 class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator
41 {
42 public:
44  vtkTemplateTypeMacro(vtkArrayIteratorTemplate<T>, vtkArrayIterator)
45  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
46 
54  void Initialize(vtkAbstractArray* array) VTK_OVERRIDE;
55 
59  vtkAbstractArray* GetArray(){ return this->Array; }
60 
61 
65  T* GetTuple(vtkIdType id);
66 
71  { return this->Pointer[id]; }
72 
78  void SetValue(vtkIdType id, T value)
79  {
80  this->Pointer[id] = value;
81  }
82 
86  vtkIdType GetNumberOfTuples();
87 
91  vtkIdType GetNumberOfValues();
92 
96  int GetNumberOfComponents();
97 
101  int GetDataType() VTK_OVERRIDE;
102 
106  int GetDataTypeSize();
107 
111  typedef T ValueType;
112 
113 protected:
115  ~vtkArrayIteratorTemplate() VTK_OVERRIDE;
116 
117  T* Pointer;
118 private:
119  vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&) VTK_DELETE_FUNCTION;
120  void operator=(const vtkArrayIteratorTemplate&) VTK_DELETE_FUNCTION;
121 
122  void SetArray(vtkAbstractArray*);
123  vtkAbstractArray* Array;
124 };
125 
126 #ifdef VTK_USE_EXTERN_TEMPLATE
127 #ifndef vtkArrayIteratorTemplateInstantiate_cxx
128 #ifdef _MSC_VER
129 #pragma warning (push)
130 // The following is needed when the vtkArrayIteratorTemplate is declared
131 // dllexport and is used from another class in vtkCommonCore
132 #pragma warning (disable: 4910) // extern and dllexport incompatible
133 #endif
135  extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
136 extern template class VTKCOMMONCORE_EXPORT
138 extern template class VTKCOMMONCORE_EXPORT
140 extern template class VTKCOMMONCORE_EXPORT
142 #ifdef _MSC_VER
143 #pragma warning (pop)
144 #endif
145 #endif
146 #endif // VTK_USE_EXTERN_TEMPLATE
147 
148 #endif
149 
150 // 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:287
Implementation template for a array iterator.
a simple class to control print indentation
Definition: vtkIndent.h:39
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:325
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...