VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkArray.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 00052 #ifndef __vtkArray_h 00053 #define __vtkArray_h 00054 00055 #include "vtkArrayCoordinates.h" 00056 #include "vtkArrayExtents.h" 00057 #include "vtkObject.h" 00058 #include "vtkStdString.h" 00059 #include "vtkVariant.h" 00060 00061 class VTK_COMMON_EXPORT vtkArray : public vtkObject 00062 { 00063 public: 00064 vtkTypeRevisionMacro(vtkArray, vtkObject); 00065 void PrintSelf(ostream &os, vtkIndent indent); 00066 00067 //BTX 00068 enum 00069 { 00071 DENSE = 0, 00073 SPARSE = 1 00074 }; 00075 //ETX 00076 00083 static vtkArray* CreateArray(int StorageType, int ValueType); 00084 00085 //BTX 00087 00095 void Resize(vtkIdType i); 00096 void Resize(vtkIdType i, vtkIdType j); 00097 void Resize(vtkIdType i, vtkIdType j, vtkIdType k); 00098 void Resize(const vtkArrayExtents& extents); 00100 00103 virtual vtkArrayExtents GetExtents() = 0; 00104 //ETX 00105 00108 vtkIdType GetDimensions(); 00109 00116 vtkIdType GetSize(); 00117 00121 virtual vtkIdType GetNonNullSize() = 0; 00122 00124 void SetDimensionLabel(vtkIdType i, const vtkStdString& label); 00125 00127 vtkStdString GetDimensionLabel(vtkIdType i); 00128 00129 //BTX 00135 virtual void GetCoordinatesN(const vtkIdType n, vtkArrayCoordinates& coordinates) = 0; 00136 00138 00141 inline vtkVariant GetVariantValue(vtkIdType i); 00142 inline vtkVariant GetVariantValue(vtkIdType i, vtkIdType j); 00143 inline vtkVariant GetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k); 00144 virtual vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates) = 0; 00146 00152 virtual vtkVariant GetVariantValueN(const vtkIdType n) = 0; 00153 00155 00158 inline void SetVariantValue(vtkIdType i, const vtkVariant& value); 00159 inline void SetVariantValue(vtkIdType i, vtkIdType j, const vtkVariant& value); 00160 inline void SetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k, const vtkVariant& value); 00161 virtual void SetVariantValue(const vtkArrayCoordinates& coordinates, const vtkVariant& value) = 0; 00163 00169 virtual void SetVariantValueN(const vtkIdType n, const vtkVariant& value) = 0; 00170 00172 00174 virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkArrayCoordinates& target_coordinates) = 0; 00175 virtual void CopyValue(vtkArray* source, const vtkIdType source_index, const vtkArrayCoordinates& target_coordinates) = 0; 00176 virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkIdType target_index) = 0; 00177 //ETX 00179 00181 virtual vtkArray* DeepCopy() = 0; 00182 00183 protected: 00184 vtkArray(); 00185 ~vtkArray(); 00186 00187 private: 00188 vtkArray(const vtkArray&); // Not implemented 00189 void operator=(const vtkArray&); // Not implemented 00190 00193 virtual void InternalResize(const vtkArrayExtents&) = 0; 00194 00196 virtual void InternalSetDimensionLabel(vtkIdType i, const vtkStdString& label) = 0; 00197 00199 virtual vtkStdString InternalGetDimensionLabel(vtkIdType i) = 0; 00200 }; 00201 00202 vtkVariant vtkArray::GetVariantValue(vtkIdType i) 00203 { 00204 return this->GetVariantValue(vtkArrayCoordinates(i)); 00205 } 00206 00207 vtkVariant vtkArray::GetVariantValue(vtkIdType i, vtkIdType j) 00208 { 00209 return this->GetVariantValue(vtkArrayCoordinates(i, j)); 00210 } 00211 00212 vtkVariant vtkArray::GetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k) 00213 { 00214 return this->GetVariantValue(vtkArrayCoordinates(i, j, k)); 00215 } 00216 00217 void vtkArray::SetVariantValue(vtkIdType i, const vtkVariant& value) 00218 { 00219 this->SetVariantValue(vtkArrayCoordinates(i), value); 00220 } 00221 00222 void vtkArray::SetVariantValue(vtkIdType i, vtkIdType j, const vtkVariant& value) 00223 { 00224 this->SetVariantValue(vtkArrayCoordinates(i, j), value); 00225 } 00226 00227 void vtkArray::SetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k, const vtkVariant& value) 00228 { 00229 this->SetVariantValue(vtkArrayCoordinates(i, j, k), value); 00230 } 00231 00232 #endif 00233