00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00051 #ifndef __vtkStringArray_h
00052 #define __vtkStringArray_h
00053
00054 #include "vtkAbstractArray.h"
00055 #include "vtkStdString.h"
00056
00057 class vtkStringArrayLookup;
00058
00059 class VTK_COMMON_EXPORT vtkStringArray : public vtkAbstractArray
00060 {
00061 public:
00062 static vtkStringArray* New();
00063 vtkTypeRevisionMacro(vtkStringArray,vtkAbstractArray);
00064 void PrintSelf(ostream& os, vtkIndent indent);
00065
00066
00067
00068
00069
00070
00071
00073
00074 int GetDataType()
00075 { return VTK_STRING; }
00077
00078 int IsNumeric() { return 0; }
00079
00081 void Initialize();
00082
00086 int GetDataTypeSize();
00087
00090 void Squeeze() { this->ResizeAndExtend (this->MaxId+1); }
00091
00093 int Resize(vtkIdType numTuples);
00094
00100 virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
00101
00105 virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
00106
00110 virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray* source);
00111
00113
00117 virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
00118 vtkAbstractArray* source, double* weights);
00120
00122
00127 virtual void InterpolateTuple(vtkIdType i,
00128 vtkIdType id1, vtkAbstractArray* source1,
00129 vtkIdType id2, vtkAbstractArray* source2, double t);
00131
00136 virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output);
00137
00142 virtual void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
00143
00146 int Allocate( vtkIdType sz, vtkIdType ext=1000 );
00147
00149 vtkStdString &GetValue(vtkIdType id);
00150
00152
00155 void SetValue(vtkIdType id, vtkStdString value)
00156 { this->Array[id] = value; this->DataChanged(); }
00158
00159 void SetValue(vtkIdType id, const char *value);
00160
00162
00164 virtual void SetNumberOfTuples(vtkIdType number)
00165 { this->SetNumberOfValues(this->NumberOfComponents* number); }
00167
00171 void SetNumberOfValues(vtkIdType number);
00172
00173 int GetNumberOfValues() { return this->MaxId + 1; }
00174
00175 int GetNumberOfElementComponents() { return 0; }
00176 int GetElementComponentSize() { return static_cast<int>(sizeof(vtkStdString::value_type)); }
00177
00179 void InsertValue(vtkIdType id, vtkStdString f);
00180
00181 void InsertValue(vtkIdType id, const char *val);
00182
00185 vtkIdType InsertNextValue(vtkStdString f);
00186
00187 vtkIdType InsertNextValue(const char *f);
00188
00189
00193 vtkStdString* WritePointer(vtkIdType id, vtkIdType number);
00194
00195
00196
00198
00200 vtkStdString* GetPointer(vtkIdType id) { return this->Array + id; }
00201 void* GetVoidPointer(vtkIdType id) { return this->GetPointer(id); }
00203
00204
00207 void DeepCopy( vtkAbstractArray* aa );
00208
00209
00210
00212
00221 void SetArray(vtkStdString* array, vtkIdType size, int save);
00222 virtual void SetVoidArray(void* array, vtkIdType size, int save)
00223 { this->SetArray(static_cast<vtkStdString*>(array), size, save); }
00225
00226
00234 unsigned long GetActualMemorySize();
00235
00237 virtual vtkArrayIterator* NewIterator();
00238
00243 virtual unsigned long GetDataSize();
00244
00245
00247
00248 virtual vtkIdType LookupValue(vtkVariant value);
00249 virtual void LookupValue(vtkVariant value, vtkIdList* ids);
00250 vtkIdType LookupValue(vtkStdString value);
00251 void LookupValue(vtkStdString value, vtkIdList* ids);
00252
00253 vtkIdType LookupValue(const char* value);
00254 void LookupValue(const char* value, vtkIdList* ids);
00256
00263 virtual void DataChanged();
00264
00268 virtual void ClearLookup();
00269
00270 protected:
00271 vtkStringArray(vtkIdType numComp=1);
00272 ~vtkStringArray();
00273
00274 vtkStdString* Array;
00275 vtkStdString* ResizeAndExtend(vtkIdType sz);
00276
00277 int SaveUserArray;
00278
00279 private:
00280 vtkStringArray(const vtkStringArray&);
00281 void operator=(const vtkStringArray&);
00282
00283
00284 vtkStringArrayLookup* Lookup;
00285 void UpdateLookup();
00286
00287 };
00288
00289
00290
00291 #endif