VTK
dox/Common/Core/vtkTypedArray.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTypedArray.h
00005 
00006 -------------------------------------------------------------------------
00007   Copyright 2008 Sandia Corporation.
00008   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009   the U.S. Government retains certain rights in this software.
00010 -------------------------------------------------------------------------
00011 
00012   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00013   All rights reserved.
00014   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00015 
00016      This software is distributed WITHOUT ANY WARRANTY; without even
00017      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00018      PURPOSE.  See the above copyright notice for more information.
00019 
00020 =========================================================================*/
00021 
00049 #ifndef __vtkTypedArray_h
00050 #define __vtkTypedArray_h
00051 
00052 #include "vtkArray.h"
00053 #include "vtkTypeTemplate.h"
00054 
00055 class vtkArrayCoordinates;
00056 
00057 template<typename T>
00058 class vtkTypedArray : public vtkTypeTemplate<vtkTypedArray<T>, vtkArray>
00059 {
00060 public:
00061   typedef typename vtkArray::CoordinateT CoordinateT;
00062   typedef typename vtkArray::SizeT SizeT;
00063 
00064 #if (defined(_MSC_VER) && _MSC_VER < 1400) || defined(__WRAP__)
00065   vtkVariant GetVariantValue(vtkIdType i) { return this->vtkArray::GetVariantValue(i); }
00066   vtkVariant GetVariantValue(vtkIdType i, vtkIdType j) { return this->vtkArray::GetVariantValue(i,j); }
00067   vtkVariant GetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k) { return this->vtkArray::GetVariantValue(i,j,k); }
00068   void SetVariantValue(vtkIdType i, const vtkVariant& value) { this->vtkArray::SetVariantValue(i, value); }
00069   void SetVariantValue(vtkIdType i, vtkIdType j, const vtkVariant& value) { this->vtkArray::SetVariantValue(i,j, value); }
00070   void SetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k, const vtkVariant& value) { this->vtkArray::SetVariantValue(i,j,k, value); }
00071 #else
00072   using vtkTypeTemplate<vtkTypedArray<T>, vtkArray>::GetVariantValue;
00073   using vtkTypeTemplate<vtkTypedArray<T>, vtkArray>::SetVariantValue;
00074 #endif
00075 
00076   void PrintSelf(ostream &os, vtkIndent indent);
00077 
00078   // vtkArray API
00079   virtual vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates);
00080   virtual vtkVariant GetVariantValueN(const SizeT n);
00081   virtual void SetVariantValue(const vtkArrayCoordinates& coordinates, const vtkVariant& value);
00082   virtual void SetVariantValueN(const SizeT n, const vtkVariant& value);
00083   virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkArrayCoordinates& target_coordinates);
00084   virtual void CopyValue(vtkArray* source, const SizeT source_index, const vtkArrayCoordinates& target_coordinates);
00085   virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const SizeT target_index);
00086 
00088 
00091   virtual const T& GetValue(CoordinateT i) = 0;
00092   virtual const T& GetValue(CoordinateT i, CoordinateT j) = 0;
00093   virtual const T& GetValue(CoordinateT i, CoordinateT j, CoordinateT k) = 0;
00094   virtual const T& GetValue(const vtkArrayCoordinates& coordinates) = 0;
00096 
00102   virtual const T& GetValueN(const SizeT n) = 0;
00103 
00105 
00108   virtual void SetValue(CoordinateT i, const T& value) = 0;
00109   virtual void SetValue(CoordinateT i, CoordinateT j, const T& value) = 0;
00110   virtual void SetValue(CoordinateT i, CoordinateT j, CoordinateT k, const T& value) = 0;
00111   virtual void SetValue(const vtkArrayCoordinates& coordinates, const T& value) = 0;
00113 
00119   virtual void SetValueN(const SizeT n, const T& value) = 0;
00120 
00121 protected:
00122   vtkTypedArray() {}
00123   ~vtkTypedArray() {}
00124 
00125 private:
00126   vtkTypedArray(const vtkTypedArray&); // Not implemented
00127   void operator=(const vtkTypedArray&); // Not implemented
00128 };
00129 
00130 #include "vtkTypedArray.txx"
00131 
00132 #endif
00133 
00134 // VTK-HeaderTest-Exclude: vtkTypedArray.h