VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkArray.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 00059 #ifndef vtkArray_h 00060 #define vtkArray_h 00061 00062 #include "vtkCommonCoreModule.h" // For export macro 00063 #include "vtkArrayCoordinates.h" 00064 #include "vtkArrayExtents.h" 00065 #include "vtkObject.h" 00066 #include "vtkStdString.h" 00067 #include "vtkVariant.h" 00068 00069 class VTKCOMMONCORE_EXPORT vtkArray : public vtkObject 00070 { 00071 public: 00072 vtkTypeMacro(vtkArray, vtkObject); 00073 void PrintSelf(ostream &os, vtkIndent indent); 00074 00075 typedef vtkArrayExtents::CoordinateT CoordinateT; 00076 typedef vtkArrayExtents::DimensionT DimensionT; 00077 typedef vtkArrayExtents::SizeT SizeT; 00078 00079 //BTX 00080 enum 00081 { 00083 DENSE = 0, 00085 SPARSE = 1 00086 }; 00087 //ETX 00088 00095 static vtkArray* CreateArray(int StorageType, int ValueType); 00096 00100 virtual bool IsDense() = 0; 00101 00103 00111 void Resize(const CoordinateT i); 00112 void Resize(const CoordinateT i, const CoordinateT j); 00113 void Resize(const CoordinateT i, const CoordinateT j, const CoordinateT k); 00114 void Resize(const vtkArrayRange& i); 00115 void Resize(const vtkArrayRange& i, const vtkArrayRange& j); 00116 void Resize(const vtkArrayRange& i, const vtkArrayRange& j, const vtkArrayRange& k); 00117 void Resize(const vtkArrayExtents& extents); 00119 00122 const vtkArrayRange GetExtent(DimensionT dimension); 00125 virtual const vtkArrayExtents& GetExtents() = 0; 00126 00129 DimensionT GetDimensions(); 00130 00137 SizeT GetSize(); 00138 00142 virtual SizeT GetNonNullSize() = 0; 00143 00145 void SetName(const vtkStdString& name); 00147 vtkStdString GetName(); 00148 00150 void SetDimensionLabel(DimensionT i, const vtkStdString& label); 00151 00153 vtkStdString GetDimensionLabel(DimensionT i); 00154 00160 virtual void GetCoordinatesN(const SizeT n, vtkArrayCoordinates& coordinates) = 0; 00161 00163 00166 inline vtkVariant GetVariantValue(CoordinateT i); 00167 inline vtkVariant GetVariantValue(CoordinateT i, CoordinateT j); 00168 inline vtkVariant GetVariantValue(CoordinateT i, CoordinateT j, CoordinateT k); 00169 virtual vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates) = 0; 00171 00177 virtual vtkVariant GetVariantValueN(const SizeT n) = 0; 00178 00180 00183 inline void SetVariantValue(CoordinateT i, const vtkVariant& value); 00184 inline void SetVariantValue(CoordinateT i, CoordinateT j, const vtkVariant& value); 00185 inline void SetVariantValue(CoordinateT i, CoordinateT j, CoordinateT k, const vtkVariant& value); 00186 virtual void SetVariantValue(const vtkArrayCoordinates& coordinates, const vtkVariant& value) = 0; 00188 00194 virtual void SetVariantValueN(const SizeT n, const vtkVariant& value) = 0; 00195 00197 00199 virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkArrayCoordinates& target_coordinates) = 0; 00200 virtual void CopyValue(vtkArray* source, const SizeT source_index, const vtkArrayCoordinates& target_coordinates) = 0; 00201 virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const SizeT target_index) = 0; 00203 00205 virtual vtkArray* DeepCopy() = 0; 00206 00207 protected: 00208 vtkArray(); 00209 ~vtkArray(); 00210 00211 private: 00212 vtkArray(const vtkArray&); // Not implemented 00213 void operator=(const vtkArray&); // Not implemented 00214 00216 vtkStdString Name; 00217 00220 virtual void InternalResize(const vtkArrayExtents&) = 0; 00221 00223 virtual void InternalSetDimensionLabel(DimensionT i, const vtkStdString& label) = 0; 00224 00226 00227 virtual vtkStdString InternalGetDimensionLabel(DimensionT i) = 0; 00228 }; 00230 00231 vtkVariant vtkArray::GetVariantValue(CoordinateT i) 00232 { 00233 return this->GetVariantValue(vtkArrayCoordinates(i)); 00234 } 00235 00236 vtkVariant vtkArray::GetVariantValue(CoordinateT i, CoordinateT j) 00237 { 00238 return this->GetVariantValue(vtkArrayCoordinates(i, j)); 00239 } 00240 00241 vtkVariant vtkArray::GetVariantValue(CoordinateT i, CoordinateT j, CoordinateT k) 00242 { 00243 return this->GetVariantValue(vtkArrayCoordinates(i, j, k)); 00244 } 00245 00246 void vtkArray::SetVariantValue(CoordinateT i, const vtkVariant& value) 00247 { 00248 this->SetVariantValue(vtkArrayCoordinates(i), value); 00249 } 00250 00251 void vtkArray::SetVariantValue(CoordinateT i, CoordinateT j, const vtkVariant& value) 00252 { 00253 this->SetVariantValue(vtkArrayCoordinates(i, j), value); 00254 } 00255 00256 void vtkArray::SetVariantValue(CoordinateT i, CoordinateT j, CoordinateT k, const vtkVariant& value) 00257 { 00258 this->SetVariantValue(vtkArrayCoordinates(i, j, k), value); 00259 } 00260 00261 #endif 00262 00263 // VTK-HeaderTest-Exclude: vtkArray.h