00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00046 #ifndef __vtkAbstractArray_h
00047 #define __vtkAbstractArray_h
00048
00049 #include "vtkObject.h"
00050 #include "vtkVariant.h"
00051
00052 class vtkArrayIterator;
00053 class vtkDataArray;
00054 class vtkIdList;
00055 class vtkIdTypeArray;
00056 class vtkInformation;
00057 class vtkInformationIntegerKey;
00058
00059 class VTK_COMMON_EXPORT vtkAbstractArray : public vtkObject
00060 {
00061 public:
00062 vtkTypeMacro(vtkAbstractArray,vtkObject);
00063 void PrintSelf(ostream& os, vtkIndent indent);
00064
00067 virtual int Allocate(vtkIdType sz, vtkIdType ext=1000) = 0;
00068
00070 virtual void Initialize() = 0;
00071
00074 virtual int GetDataType() =0;
00075
00077
00080 virtual int GetDataTypeSize() = 0;
00081 static int GetDataTypeSize(int type);
00083
00088 virtual int GetElementComponentSize() = 0;
00089
00091
00093 vtkSetClampMacro(NumberOfComponents, int, 1, VTK_LARGE_INTEGER);
00094 int GetNumberOfComponents() { return this->NumberOfComponents; }
00096
00098 void SetComponentName( vtkIdType component, const char *name );
00099
00102 const char* GetComponentName( vtkIdType component );
00103
00105 bool HasAComponentName();
00106
00110 int CopyComponentNames( vtkAbstractArray *da );
00111
00117 virtual void SetNumberOfTuples(vtkIdType number) = 0;
00118
00120
00121 vtkIdType GetNumberOfTuples()
00122 {return (this->MaxId + 1)/this->NumberOfComponents;}
00124
00130 virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
00131
00135 virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
00136
00140 virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray* source) = 0;
00141
00145 virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray* output);
00146
00150 virtual void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
00151
00154 virtual void *GetVoidPointer(vtkIdType id) = 0;
00155
00160 virtual void DeepCopy(vtkAbstractArray* da);
00161
00163
00167 virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
00168 vtkAbstractArray* source, double* weights) = 0;
00170
00172
00177 virtual void InterpolateTuple(vtkIdType i,
00178 vtkIdType id1, vtkAbstractArray* source1,
00179 vtkIdType id2, vtkAbstractArray* source2, double t) =0;
00181
00184 virtual void Squeeze() = 0;
00185
00188 virtual int Resize(vtkIdType numTuples) = 0;
00189
00191
00192 void Reset()
00193 {this->MaxId = -1;}
00195
00197
00198 vtkIdType GetSize()
00199 {return this->Size;}
00201
00203
00204 vtkIdType GetMaxId()
00205 {return this->MaxId;}
00207
00209
00215 virtual void SetVoidArray(void *vtkNotUsed(array),
00216 vtkIdType vtkNotUsed(size),
00217 int vtkNotUsed(save)) =0;
00219
00223 virtual void ExportToVoidPointer(void *vtkNotUsed(out_ptr)) {}
00224
00231 virtual unsigned long GetActualMemorySize() = 0;
00232
00234
00235 vtkSetStringMacro(Name);
00236 vtkGetStringMacro(Name);
00238
00240
00241 virtual const char *GetDataTypeAsString( void )
00242 { return vtkImageScalarTypeNameMacro( this->GetDataType() ); }
00244
00250 static vtkAbstractArray* CreateArray(int dataType);
00251
00254 virtual int IsNumeric() = 0;
00255
00258 virtual vtkArrayIterator* NewIterator() = 0;
00259
00261
00265 virtual vtkIdType GetDataSize()
00266 {
00267 return this->GetNumberOfComponents() * this->GetNumberOfTuples();
00268 }
00270
00272
00273 virtual vtkIdType LookupValue(vtkVariant value) = 0;
00274 virtual void LookupValue(vtkVariant value, vtkIdList* ids) = 0;
00276
00278 virtual vtkVariant GetVariantValue(vtkIdType idx);
00279
00282 virtual void InsertVariantValue(vtkIdType idx, vtkVariant value);
00283
00286 virtual void SetVariantValue(vtkIdType idx, vtkVariant value) = 0;
00287
00294 virtual void DataChanged() = 0;
00295
00299 virtual void ClearLookup() = 0;
00300
00301
00302
00303
00304
00305
00306
00308
00311 vtkInformation* GetInformation();
00312
00313
00314
00315 bool HasInformation(){ return this->Information!=0; }
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327 virtual int CopyInformation(vtkInformation *infoFrom, int deep=1);
00328
00330
00333 static vtkInformationIntegerKey* GUI_HIDE();
00334
00335 protected:
00339 virtual void SetInformation( vtkInformation* );
00340
00341
00342 vtkAbstractArray(vtkIdType numComp=1);
00343 ~vtkAbstractArray();
00344
00345 vtkIdType Size;
00346 vtkIdType MaxId;
00347 int NumberOfComponents;
00348
00349 char* Name;
00350
00351 bool RebuildArray;
00352
00353 vtkInformation* Information;
00354
00355
00356 class vtkInternalComponentNames;
00357 vtkInternalComponentNames* ComponentNames;
00358
00359
00360 private:
00361 vtkAbstractArray(const vtkAbstractArray&);
00362 void operator=(const vtkAbstractArray&);
00363 };
00364
00365 #endif