VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkArrayIteratorTemplate.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00028 #ifndef __vtkArrayIteratorTemplate_h 00029 #define __vtkArrayIteratorTemplate_h 00030 00031 #include "vtkCommonCoreModule.h" // For export macro 00032 #include "vtkArrayIterator.h" 00033 00034 template <class T> 00035 class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator 00036 { 00037 public: 00038 static vtkArrayIteratorTemplate<T>* New(); 00039 typedef vtkArrayIterator Superclass; 00040 private: 00041 virtual const char* GetClassNameInternal() const 00042 { return "vtkArrayIteratorTemplate"; } 00043 00044 public: 00045 void PrintSelf(ostream& os, vtkIndent indent); 00046 00051 virtual void Initialize(vtkAbstractArray* array); 00052 00054 vtkAbstractArray* GetArray(){ return this->Array; } 00055 00056 00058 T* GetTuple(vtkIdType id); 00059 00061 00062 T& GetValue(vtkIdType id) 00063 { return this->Pointer[id]; } 00065 00067 00070 void SetValue(vtkIdType id, T value) 00071 { 00072 this->Pointer[id] = value; 00073 } 00075 00077 vtkIdType GetNumberOfTuples(); 00078 00080 vtkIdType GetNumberOfValues(); 00081 00083 int GetNumberOfComponents(); 00084 00086 int GetDataType(); 00087 00089 int GetDataTypeSize(); 00090 00092 00093 typedef T ValueType; 00094 protected: 00095 vtkArrayIteratorTemplate(); 00096 ~vtkArrayIteratorTemplate(); 00098 00099 T* Pointer; 00100 private: 00101 vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&); // Not implemented. 00102 void operator=(const vtkArrayIteratorTemplate&); // Not implemented. 00103 00104 void SetArray(vtkAbstractArray*); 00105 vtkAbstractArray* Array; 00106 }; 00107 00108 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION) 00109 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \ 00110 template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate< T > 00111 #else 00112 # include "vtkArrayIteratorTemplateImplicit.txx" // needed for templates. 00113 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) 00114 #endif // !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION) 00115 00116 #endif // !defined(__vtkArrayIteratorTemplate_h) 00117 00118 // This portion must be OUTSIDE the include blockers. Each 00119 // vtkArrayIteratorTemplate subclass uses this to give its instantiation 00120 // of this template a DLL interface. 00121 #if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE) 00122 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER) 00123 # pragma warning (push) 00124 # pragma warning (disable: 4091) // warning C4091: 'extern ' : 00125 // ignored on left of 'int' when no variable is declared 00126 # pragma warning (disable: 4231) // Compiler-specific extension warning. 00127 // Use an "extern explicit instantiation" to give the class a DLL 00128 // interface. This is a compiler-specific extension. 00129 extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE); 00130 # pragma warning (pop) 00131 # endif 00132 # undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE 00133 #endif 00134 00135 // VTK-HeaderTest-Exclude: vtkArrayIteratorTemplate.h