VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "vtkArrayIterator.h"
33 
34 template <class T>
35 class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator
36 {
37 public:
40 private:
41  virtual const char* GetClassNameInternal() const
42  { return "vtkArrayIteratorTemplate"; }
43 
44 public:
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
51  virtual void Initialize(vtkAbstractArray* array);
52 
54  vtkAbstractArray* GetArray(){ return this->Array; }
55 
56 
58  T* GetTuple(vtkIdType id);
59 
61 
63  { return this->Pointer[id]; }
65 
67 
70  void SetValue(vtkIdType id, T value)
71  {
72  this->Pointer[id] = value;
73  }
75 
77  vtkIdType GetNumberOfTuples();
78 
80  vtkIdType GetNumberOfValues();
81 
83  int GetNumberOfComponents();
84 
86  int GetDataType();
87 
89  int GetDataTypeSize();
90 
92 
93  typedef T ValueType;
94 protected:
98 
99  T* Pointer;
100 private:
101  vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&); // Not implemented.
102  void operator=(const vtkArrayIteratorTemplate&); // Not implemented.
103 
104  void SetArray(vtkAbstractArray*);
105  vtkAbstractArray* Array;
106 };
107 
108 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
109 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \
110  template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate< T >
111 #else
112 # include "vtkArrayIteratorTemplateImplicit.txx" // needed for templates.
113 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T)
114 #endif // !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
115 
116 #endif // !defined(__vtkArrayIteratorTemplate_h)
117 
118 // This portion must be OUTSIDE the include blockers. Each
119 // vtkArrayIteratorTemplate subclass uses this to give its instantiation
120 // of this template a DLL interface.
121 #if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE)
122 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER)
123 # pragma warning (push)
124 # pragma warning (disable: 4091) // warning C4091: 'extern ' :
125  // ignored on left of 'int' when no variable is declared
126 # pragma warning (disable: 4231) // Compiler-specific extension warning.
127  // Use an "extern explicit instantiation" to give the class a DLL
128  // interface. This is a compiler-specific extension.
129  extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE);
130 # pragma warning (pop)
131 # endif
132 # undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE
133 #endif
134 
135 // VTK-HeaderTest-Exclude: vtkArrayIteratorTemplate.h
virtual int GetDataType()=0
Abstract superclass for all arrays.
int vtkIdType
Definition: vtkType.h:268
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:38
void SetValue(vtkIdType id, T value)
Abstract superclass to iterate over elements in an vtkAbstractArray.
#define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T)
static vtkObject * New()