00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 vtkTypeMacro(vtkArray, vtkObject);
00065 void PrintSelf(ostream &os, vtkIndent indent);
00066
00067
00068 enum
00069 {
00071 DENSE = 0,
00073 SPARSE = 1
00074 };
00075
00076
00083 static vtkArray* CreateArray(int StorageType, int ValueType);
00084
00088 virtual bool IsDense() = 0;
00089
00091
00099 void Resize(const vtkIdType i);
00100 void Resize(const vtkIdType i, const vtkIdType j);
00101 void Resize(const vtkIdType i, const vtkIdType j, const vtkIdType k);
00103
00104 void Resize(const vtkArrayRange& i);
00105 void Resize(const vtkArrayRange& i, const vtkArrayRange& j);
00106 void Resize(const vtkArrayRange& i, const vtkArrayRange& j, const vtkArrayRange& k);
00107 void Resize(const vtkArrayExtents& extents);
00108
00109
00110
00112
00114 const vtkArrayRange GetExtent(vtkIdType dimension);
00115
00116
00117 virtual const vtkArrayExtents& GetExtents() = 0;
00119
00120
00123 vtkIdType GetDimensions();
00124
00131 vtkIdType GetSize();
00132
00136 virtual vtkIdType GetNonNullSize() = 0;
00137
00139
00140 void SetName(const vtkStdString& name);
00141
00142
00143 vtkStdString GetName();
00145
00147 void SetDimensionLabel(vtkIdType i, const vtkStdString& label);
00148
00150 vtkStdString GetDimensionLabel(vtkIdType i);
00151
00152
00158 virtual void GetCoordinatesN(const vtkIdType n, vtkArrayCoordinates& coordinates) = 0;
00159
00161
00164 inline vtkVariant GetVariantValue(vtkIdType i);
00165 inline vtkVariant GetVariantValue(vtkIdType i, vtkIdType j);
00166 inline vtkVariant GetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k);
00167 virtual vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates) = 0;
00169
00175 virtual vtkVariant GetVariantValueN(const vtkIdType n) = 0;
00176
00178
00181 inline void SetVariantValue(vtkIdType i, const vtkVariant& value);
00182 inline void SetVariantValue(vtkIdType i, vtkIdType j, const vtkVariant& value);
00183 inline void SetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k, const vtkVariant& value);
00184 virtual void SetVariantValue(const vtkArrayCoordinates& coordinates, const vtkVariant& value) = 0;
00186
00192 virtual void SetVariantValueN(const vtkIdType n, const vtkVariant& value) = 0;
00193
00195
00197 virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkArrayCoordinates& target_coordinates) = 0;
00198 virtual void CopyValue(vtkArray* source, const vtkIdType source_index, const vtkArrayCoordinates& target_coordinates) = 0;
00199 virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkIdType target_index) = 0;
00200
00202
00204 virtual vtkArray* DeepCopy() = 0;
00205
00206 protected:
00207 vtkArray();
00208 ~vtkArray();
00209
00210 private:
00211 vtkArray(const vtkArray&);
00212 void operator=(const vtkArray&);
00213
00215 vtkStdString Name;
00216
00219 virtual void InternalResize(const vtkArrayExtents&) = 0;
00220
00222 virtual void InternalSetDimensionLabel(vtkIdType i, const vtkStdString& label) = 0;
00223
00225 virtual vtkStdString InternalGetDimensionLabel(vtkIdType i) = 0;
00226 };
00227
00228 vtkVariant vtkArray::GetVariantValue(vtkIdType i)
00229 {
00230 return this->GetVariantValue(vtkArrayCoordinates(i));
00231 }
00232
00233 vtkVariant vtkArray::GetVariantValue(vtkIdType i, vtkIdType j)
00234 {
00235 return this->GetVariantValue(vtkArrayCoordinates(i, j));
00236 }
00237
00238 vtkVariant vtkArray::GetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k)
00239 {
00240 return this->GetVariantValue(vtkArrayCoordinates(i, j, k));
00241 }
00242
00243 void vtkArray::SetVariantValue(vtkIdType i, const vtkVariant& value)
00244 {
00245 this->SetVariantValue(vtkArrayCoordinates(i), value);
00246 }
00247
00248 void vtkArray::SetVariantValue(vtkIdType i, vtkIdType j, const vtkVariant& value)
00249 {
00250 this->SetVariantValue(vtkArrayCoordinates(i, j), value);
00251 }
00252
00253 void vtkArray::SetVariantValue(vtkIdType i, vtkIdType j, vtkIdType k, const vtkVariant& value)
00254 {
00255 this->SetVariantValue(vtkArrayCoordinates(i, j, k), value);
00256 }
00257
00258 #endif
00259