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 =========================================================================*/
28 #ifndef vtkArrayIteratorTemplate_h
29 #define vtkArrayIteratorTemplate_h
30 
31 #include "vtkCommonCoreModule.h" // For export macro
32 #include "vtkTypeTemplate.h" // For templated vtkObject API
33 #include "vtkArrayIterator.h"
34 
35 template <class T>
37  public vtkTypeTemplate<vtkArrayIteratorTemplate<T>, vtkArrayIterator>
38 {
39 public:
40  static vtkArrayIteratorTemplate<T>* New();
42 private:
43  virtual const char* GetClassNameInternal() const
44  { return "vtkArrayIteratorTemplate"; }
45 
46 public:
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
53  virtual void Initialize(vtkAbstractArray* array);
54 
56  vtkAbstractArray* GetArray(){ return this->Array; }
57 
58 
60  T* GetTuple(vtkIdType id);
61 
63 
65  { return this->Pointer[id]; }
67 
69 
72  void SetValue(vtkIdType id, T value)
73  {
74  this->Pointer[id] = value;
75  }
77 
79  vtkIdType GetNumberOfTuples();
80 
82  vtkIdType GetNumberOfValues();
83 
85  int GetNumberOfComponents();
86 
88  int GetDataType();
89 
91  int GetDataTypeSize();
92 
94 
95  typedef T ValueType;
96 protected:
100 
102 private:
103  vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&); // Not implemented.
104  void operator=(const vtkArrayIteratorTemplate&); // Not implemented.
105 
106  void SetArray(vtkAbstractArray*);
107  vtkAbstractArray* Array;
108 };
109 
110 #define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \
111  template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate< T >
112 
113 #endif // !defined(vtkArrayIteratorTemplate_h)
114 
115 // This portion must be OUTSIDE the include blockers. Each
116 // vtkArrayIteratorTemplate subclass uses this to give its instantiation
117 // of this template a DLL interface.
118 #if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE)
119 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER)
120 # pragma warning (push)
121 # pragma warning (disable: 4091) // warning C4091: 'extern ' :
122  // ignored on left of 'int' when no variable is declared
123 # pragma warning (disable: 4231) // Compiler-specific extension warning.
124  // Use an "extern explicit instantiation" to give the class a DLL
125  // interface. This is a compiler-specific extension.
126  extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE);
127 # pragma warning (pop)
128 # endif
129 # undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE
130 #endif
131 
132 // VTK-HeaderTest-Exclude: vtkArrayIteratorTemplate.h
Provides the equivalent of vtkTypeMacro for use with template classes.
Abstract superclass for all arrays.
#define VTKCOMMONCORE_EXPORT
int vtkIdType
Definition: vtkType.h:247
Implementation template for a array iterator.
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetValue(vtkIdType id, T value)
Abstract superclass to iterate over elements in an vtkAbstractArray.
#define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T)