VTK
dox/Common/vtkArrayIteratorTemplate.h
Go to the documentation of this file.
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 "vtkArrayIterator.h"
00032 
00033 template <class T>
00034 class VTK_COMMON_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator
00035 {
00036 public:
00037   static vtkArrayIteratorTemplate<T>* New();
00038   typedef vtkArrayIterator Superclass;
00039 private:
00040   virtual const char* GetClassNameInternal() const
00041     { return "vtkArrayIteratorTemplate"; }
00042 
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 
00092   typedef T ValueType;
00093 protected:
00094   vtkArrayIteratorTemplate();
00095   ~vtkArrayIteratorTemplate();
00097 
00098   T* Pointer;
00099 private:
00100   vtkArrayIteratorTemplate(const vtkArrayIteratorTemplate&); // Not implemented.
00101   void operator=(const vtkArrayIteratorTemplate&); // Not implemented.
00102 
00103  void SetArray(vtkAbstractArray*);
00104  vtkAbstractArray* Array;
00105 };
00106 
00107 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
00108 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \
00109    template class VTK_COMMON_EXPORT vtkArrayIteratorTemplate< T >
00110 #else
00111 # include "vtkArrayIteratorTemplateImplicit.txx" // needed for templates.
00112 # define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T)
00113 #endif // !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
00114 
00115 #endif // !defined(__vtkArrayIteratorTemplate_h)
00116 
00117 // This portion must be OUTSIDE the include blockers.  Each
00118 // vtkArrayIteratorTemplate subclass uses this to give its instantiation
00119 // of this template a DLL interface.
00120 #if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE)
00121 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER)
00122 #  pragma warning (push)
00123 #  pragma warning (disable: 4091) // warning C4091: 'extern ' :
00124    // ignored on left of 'int' when no variable is declared
00125 #  pragma warning (disable: 4231) // Compiler-specific extension warning.
00126    // Use an "extern explicit instantiation" to give the class a DLL
00127    // interface.  This is a compiler-specific extension.
00128    extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE);
00129 #  pragma warning (pop)
00130 # endif
00131 # undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE
00132 #endif
00133