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 "vtkArrayIterator.h"
32 
33 template <class T>
35 {
36 public:
39 private:
40  virtual const char* GetClassNameInternal() const
41  { return "vtkArrayIteratorTemplate"; }
42 
43 public:
44  void PrintSelf(ostream& os, vtkIndent indent);
45 
50  virtual void Initialize(vtkAbstractArray* array);
51 
53  vtkAbstractArray* GetArray(){ return this->Array; }
54 
55 
57  T* GetTuple(vtkIdType id);
58 
60 
62  { return this->Pointer[id]; }
64 
66 
69  void SetValue(vtkIdType id, T value)
70  {
71  this->Pointer[id] = value;
72  }
74 
76  vtkIdType GetNumberOfTuples();
77 
79  vtkIdType GetNumberOfValues();
80 
82  int GetNumberOfComponents();
83 
85  int GetDataType();
86 
88  int GetDataTypeSize();
89 
91 
92  typedef T ValueType;
93 protected:
97 
98  T* Pointer;
99 private:
100  vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&); // Not implemented.
101  void operator=(const vtkArrayIteratorTemplate&); // Not implemented.
102 
103  void SetArray(vtkAbstractArray*);
104  vtkAbstractArray* Array;
105 };
106 
107 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
108 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \
109  template class VTK_COMMON_EXPORT vtkArrayIteratorTemplate< T >
110 #else
111 # include "vtkArrayIteratorTemplateImplicit.txx" // needed for templates.
112 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T)
113 #endif // !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
114 
115 #endif // !defined(__vtkArrayIteratorTemplate_h)
116 
117 // This portion must be OUTSIDE the include blockers. Each
118 // vtkArrayIteratorTemplate subclass uses this to give its instantiation
119 // of this template a DLL interface.
120 #if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE)
121 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER)
122 # pragma warning (push)
123 # pragma warning (disable: 4091) // warning C4091: 'extern ' :
124  // ignored on left of 'int' when no variable is declared
125 # pragma warning (disable: 4231) // Compiler-specific extension warning.
126  // Use an "extern explicit instantiation" to give the class a DLL
127  // interface. This is a compiler-specific extension.
128  extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE);
129 # pragma warning (pop)
130 # endif
131 # undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE
132 #endif
133 
virtual int GetDataType()=0
Abstract superclass for all arrays.
int vtkIdType
Definition: vtkType.h:255
void PrintSelf(ostream &os, vtkIndent indent)
Implementation template for a array iterator.
virtual void Initialize(vtkAbstractArray *array)=0
a simple class to control print indentation
Definition: vtkIndent.h:37
void SetValue(vtkIdType id, T value)
#define VTK_COMMON_EXPORT
Abstract superclass to iterate over elements in an vtkAbstractArray.
#define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T)
static vtkObject * New()