VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkTypedArray.h,v $ 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 using vtkTypeTemplate<vtkTypedArray<T>, vtkArray>::GetVariantValue; 00062 using vtkTypeTemplate<vtkTypedArray<T>, vtkArray>::SetVariantValue; 00063 00064 void PrintSelf(ostream &os, vtkIndent indent); 00065 00066 // vtkArray API 00067 virtual vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates); 00068 virtual vtkVariant GetVariantValueN(const vtkIdType n); 00069 virtual void SetVariantValue(const vtkArrayCoordinates& coordinates, const vtkVariant& value); 00070 virtual void SetVariantValueN(const vtkIdType n, const vtkVariant& value); 00071 virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkArrayCoordinates& target_coordinates); 00072 virtual void CopyValue(vtkArray* source, const vtkIdType source_index, const vtkArrayCoordinates& target_coordinates); 00073 virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkIdType target_index); 00074 00076 00079 inline const T& GetValue(vtkIdType i); 00080 inline const T& GetValue(vtkIdType i, vtkIdType j); 00081 inline const T& GetValue(vtkIdType i, vtkIdType j, vtkIdType k); 00082 virtual const T& GetValue(const vtkArrayCoordinates& coordinates) = 0; 00084 00090 virtual const T& GetValueN(const vtkIdType n) = 0; 00091 00093 00096 inline void SetValue(vtkIdType i, const T& value); 00097 inline void SetValue(vtkIdType i, vtkIdType j, const T& value); 00098 inline void SetValue(vtkIdType i, vtkIdType j, vtkIdType k, const T& value); 00099 virtual void SetValue(const vtkArrayCoordinates& coordinates, const T& value) = 0; 00101 00107 virtual void SetValueN(const vtkIdType n, const T& value) = 0; 00108 00109 protected: 00110 vtkTypedArray() {} 00111 ~vtkTypedArray() {} 00112 00113 private: 00114 vtkTypedArray(const vtkTypedArray&); // Not implemented 00115 void operator=(const vtkTypedArray&); // Not implemented 00116 }; 00117 00118 #include "vtkTypedArray.txx" 00119 00120 #endif 00121