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 =========================================================================*/ 00026 #ifndef __vtkArrayIteratorTemplate_h 00027 #define __vtkArrayIteratorTemplate_h 00028 00029 #include "vtkArrayIterator.h" 00030 00031 template <class T> 00032 class VTK_COMMON_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator 00033 { 00034 public: 00035 static vtkArrayIteratorTemplate<T>* New(); 00036 typedef vtkArrayIterator Superclass; 00037 private: 00038 virtual const char* GetClassNameInternal() const 00039 { return "vtkArrayIteratorTemplate"; } 00040 00041 public: 00042 void PrintSelf(ostream& os, vtkIndent indent); 00043 00048 virtual void Initialize(vtkAbstractArray* array); 00049 00051 vtkAbstractArray* GetArray(){ return this->Array; } 00052 00053 00055 T* GetTuple(vtkIdType id); 00056 00058 00059 T& GetValue(vtkIdType id) 00060 { return this->Pointer[id]; } 00062 00064 00067 void SetValue(vtkIdType id, T value) 00068 { 00069 this->Pointer[id] = value; 00070 } 00072 00074 vtkIdType GetNumberOfTuples(); 00075 00077 vtkIdType GetNumberOfValues(); 00078 00080 int GetNumberOfComponents(); 00081 00083 int GetDataType(); 00084 00086 int GetDataTypeSize(); 00087 00089 typedef T ValueType; 00090 protected: 00091 vtkArrayIteratorTemplate(); 00092 ~vtkArrayIteratorTemplate(); 00093 00094 T* Pointer; 00095 private: 00096 vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&); // Not implemented. 00097 void operator=(const vtkArrayIteratorTemplate&); // Not implemented. 00098 00099 void SetArray(vtkAbstractArray*); 00100 vtkAbstractArray* Array; 00101 }; 00102 00103 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION) 00104 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \ 00105 template class VTK_COMMON_EXPORT vtkArrayIteratorTemplate< T > 00106 #else 00107 # include "vtkArrayIteratorTemplateImplicit.txx" // needed for templates. 00108 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) 00109 #endif // !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION) 00110 00111 #endif // !defined(__vtkArrayIteratorTemplate_h) 00112 00113 // This portion must be OUTSIDE the include blockers. Each 00114 // vtkArrayIteratorTemplate subclass uses this to give its instantiation of this 00115 // template a DLL interface. 00116 #if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE) 00117 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER) 00118 # pragma warning (push) 00119 # pragma warning (disable: 4091) // warning C4091: 'extern ' : 00120 // ignored on left of 'int' when no variable is declared 00121 # pragma warning (disable: 4231) // Compiler-specific extension warning. 00122 // Use an "extern explicit instantiation" to give the class a DLL 00123 // interface. This is a compiler-specific extension. 00124 extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE); 00125 # pragma warning (pop) 00126 # endif 00127 # undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE 00128 #endif 00129