VTK  9.2.6
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 "vtkArrayIterator.h"
33#include "vtkCommonCoreModule.h" // For export macro
34
35#include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
36#include "vtkStdString.h" // For template instantiation
37#include "vtkVariant.h" // For template instantiation
38
39template <class T>
40class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
54 void Initialize(vtkAbstractArray* array) override;
55
59 vtkAbstractArray* GetArray() { return this->Array; }
60
65
69 T& GetValue(vtkIdType id) { return this->Pointer[id]; }
70
76 void SetValue(vtkIdType id, T value) { this->Pointer[id] = value; }
77
82
87
92
96 int GetDataType() const override;
97
101 int GetDataTypeSize() const;
102
106 typedef T ValueType;
107
108protected:
111
113
114private:
116 void operator=(const vtkArrayIteratorTemplate&) = delete;
117
118 void SetArray(vtkAbstractArray*);
119 vtkAbstractArray* Array;
120};
121
122#ifdef VTK_USE_EXTERN_TEMPLATE
123#ifndef vtkArrayIteratorTemplateInstantiate_cxx
124#ifdef _MSC_VER
125#pragma warning(push)
126// The following is needed when the vtkArrayIteratorTemplate is declared
127// dllexport and is used from another class in vtkCommonCore
128#pragma warning(disable : 4910) // extern and dllexport incompatible
129#endif
130vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate);
131extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkStdString>;
132extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkVariant>;
133#ifdef _MSC_VER
134#pragma warning(pop)
135#endif
136#endif
137#endif // VTK_USE_EXTERN_TEMPLATE
138
139#endif
140
141// 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.
int GetNumberOfComponents() const
Must be called only after Initialize.
vtkIdType GetNumberOfTuples() const
Must be called only after Initialize.
void Initialize(vtkAbstractArray *array) override
Set the array this iterator will iterate over.
static vtkArrayIteratorTemplate< T > * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractArray * GetArray()
Get the array.
~vtkArrayIteratorTemplate() override
int GetDataType() const override
Get the data type from the underlying array.
void SetValue(vtkIdType id, T value)
Sets the value at the index.
T & GetValue(vtkIdType id)
Must be called only after Initialize.
T * GetTuple(vtkIdType id)
Must be called only after Initialize.
vtkIdType GetNumberOfValues() const
Must be called only after Initialize.
int GetDataTypeSize() const
Get the data type size from the underlying array.
vtkTemplateTypeMacro(vtkArrayIteratorTemplate< T >, vtkArrayIterator)
Abstract superclass to iterate over elements in an vtkAbstractArray.
a simple class to control print indentation
Definition: vtkIndent.h:40
int vtkIdType
Definition: vtkType.h:332
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
Definition: vtkType.h:378