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 "vtkTypeTemplate.h" // For templated vtkObject API 00033 #include "vtkArrayIterator.h" 00034 00035 template <class T> 00036 class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : 00037 public vtkTypeTemplate<vtkArrayIteratorTemplate<T>, vtkArrayIterator> 00038 { 00039 public: 00040 static vtkArrayIteratorTemplate<T>* New(); 00041 typedef vtkArrayIterator Superclass; 00042 private: 00043 virtual const char* GetClassNameInternal() const 00044 { return "vtkArrayIteratorTemplate"; } 00045 00046 public: 00047 void PrintSelf(ostream& os, vtkIndent indent); 00048 00053 virtual void Initialize(vtkAbstractArray* array); 00054 00056 vtkAbstractArray* GetArray(){ return this->Array; } 00057 00058 00060 T* GetTuple(vtkIdType id); 00061 00063 00064 T& GetValue(vtkIdType id) 00065 { return this->Pointer[id]; } 00067 00069 00072 void SetValue(vtkIdType id, T value) 00073 { 00074 this->Pointer[id] = value; 00075 } 00077 00079 vtkIdType GetNumberOfTuples(); 00080 00082 vtkIdType GetNumberOfValues(); 00083 00085 int GetNumberOfComponents(); 00086 00088 int GetDataType(); 00089 00091 int GetDataTypeSize(); 00092 00094 00095 typedef T ValueType; 00096 protected: 00097 vtkArrayIteratorTemplate(); 00098 ~vtkArrayIteratorTemplate(); 00100 00101 T* Pointer; 00102 private: 00103 vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&); // Not implemented. 00104 void operator=(const vtkArrayIteratorTemplate&); // Not implemented. 00105 00106 void SetArray(vtkAbstractArray*); 00107 vtkAbstractArray* Array; 00108 }; 00109 00110 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION) 00111 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \ 00112 template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate< T > 00113 #else 00114 # include "vtkArrayIteratorTemplateImplicit.txx" // needed for templates. 00115 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) 00116 #endif // !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION) 00117 00118 #endif // !defined(__vtkArrayIteratorTemplate_h) 00119 00120 // This portion must be OUTSIDE the include blockers. Each 00121 // vtkArrayIteratorTemplate subclass uses this to give its instantiation 00122 // of this template a DLL interface. 00123 #if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE) 00124 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER) 00125 # pragma warning (push) 00126 # pragma warning (disable: 4091) // warning C4091: 'extern ' : 00127 // ignored on left of 'int' when no variable is declared 00128 # pragma warning (disable: 4231) // Compiler-specific extension warning. 00129 // Use an "extern explicit instantiation" to give the class a DLL 00130 // interface. This is a compiler-specific extension. 00131 extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE); 00132 # pragma warning (pop) 00133 # endif 00134 # undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE 00135 #endif 00136 00137 // VTK-HeaderTest-Exclude: vtkArrayIteratorTemplate.h