VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkArrayIteratorTemplate.h,v $ 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 protected: 00042 void CollectRevisions(ostream& os); 00043 public: 00044 void PrintSelf(ostream& os, vtkIndent indent); 00045 00050 virtual void Initialize(vtkAbstractArray* array); 00051 00053 vtkAbstractArray* GetArray(){ return this->Array; } 00054 00055 00057 T* GetTuple(vtkIdType id); 00058 00060 00061 T& GetValue(vtkIdType id) 00062 { return this->Pointer[id]; } 00064 00066 00069 void SetValue(vtkIdType id, T value) 00070 { 00071 this->Pointer[id] = value; 00072 } 00074 00076 vtkIdType GetNumberOfTuples(); 00077 00079 vtkIdType GetNumberOfValues(); 00080 00082 int GetNumberOfComponents(); 00083 00085 int GetDataType(); 00086 00088 int GetDataTypeSize(); 00089 00091 typedef T ValueType; 00092 protected: 00093 vtkArrayIteratorTemplate(); 00094 ~vtkArrayIteratorTemplate(); 00095 00096 T* Pointer; 00097 private: 00098 vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&); // Not implemented. 00099 void operator=(const vtkArrayIteratorTemplate&); // Not implemented. 00100 00101 void SetArray(vtkAbstractArray*); 00102 vtkAbstractArray* Array; 00103 }; 00104 00105 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION) 00106 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \ 00107 template class VTK_COMMON_EXPORT vtkArrayIteratorTemplate< T > 00108 #else 00109 # include "vtkArrayIteratorTemplateImplicit.txx" // needed for templates. 00110 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) 00111 #endif // !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION) 00112 00113 #endif // !defined(__vtkArrayIteratorTemplate_h) 00114 00115 // This portion must be OUTSIDE the include blockers. Each 00116 // vtkArrayIteratorTemplate subclass uses this to give its instantiation of this 00117 // template a DLL interface. 00118 #if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE) 00119 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER) 00120 # pragma warning (push) 00121 # pragma warning (disable: 4091) // warning C4091: 'extern ' : 00122 // ignored on left of 'int' when no variable is declared 00123 # pragma warning (disable: 4231) // Compiler-specific extension warning. 00124 // Use an "extern explicit instantiation" to give the class a DLL 00125 // interface. This is a compiler-specific extension. 00126 extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE); 00127 # pragma warning (pop) 00128 # endif 00129 # undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE 00130 #endif 00131