Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkStringArray.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkStringArray.h,v $
00005   Language:  C++
00006 
00007   Copyright 2004 Sandia Corporation.
00008   Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009   license for use of this work by or on behalf of the
00010   U.S. Government. Redistribution and use in source and binary forms, with
00011   or without modification, are permitted provided that this Notice and any
00012   statement of authorship are reproduced on all copies.
00013 
00014 =========================================================================*/
00015 
00048 #ifndef __vtkStringArray_h
00049 #define __vtkStringArray_h
00050 
00051 #include "vtkAbstractArray.h"
00052 #include "vtkStdString.h" // needed for vtkStdString definition
00053 
00054 class VTK_COMMON_EXPORT vtkStringArray : public vtkAbstractArray
00055 {
00056 public:
00057   static vtkStringArray* New();
00058   vtkTypeRevisionMacro(vtkStringArray,vtkAbstractArray);
00059   void PrintSelf(ostream& os, vtkIndent indent);
00060 
00061   //
00062   // 
00063   // Functions required by vtkAbstractArray
00064   //
00065   //
00066 
00068 
00069   int GetDataType()
00070     { return VTK_STRING; }
00072 
00073   bool IsNumeric() { return false; } 
00074 
00076   void Initialize();
00077 
00081   int GetDataTypeSize();
00082 
00085   void Squeeze() { this->ResizeAndExtend (this->MaxId+1); }
00086 
00088   int Resize(vtkIdType numTuples);
00089 
00094   void GetValues(vtkIdList *ptIds, vtkAbstractArray *output);
00095 
00100   void GetValues(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
00101 
00103   void CopyValue(int toIndex, int fromIndex, vtkAbstractArray *sourceArray);
00104 
00107   int Allocate( vtkIdType sz, vtkIdType ext=1000 );
00108 
00110   vtkStdString &GetValue(vtkIdType id);
00111 
00113 
00116   void SetValue(vtkIdType id, vtkStdString value)
00117     { this->Array[id] = value; }
00119 //ETX
00120   void SetValue(vtkIdType id, const char *value);
00121 
00125   void SetNumberOfValues(vtkIdType number);
00126 
00127   int GetNumberOfValues() { return this->MaxId + 1; }
00128 
00129   int GetNumberOfElementComponents() { return 0; }
00130   int GetElementComponentSize() { return static_cast<int>(sizeof(vtkStdString::value_type)); }
00131 
00133   void InsertValue(vtkIdType id, vtkStdString f);
00134 //ETX
00135   void InsertValue(vtkIdType id, const char *val);
00136 
00139   vtkIdType InsertNextValue(vtkStdString f);
00140 //ETX
00141   vtkIdType InsertNextValue(const char *f);
00142 
00143 //BTX
00147   vtkStdString* WritePointer(vtkIdType id, vtkIdType number);
00148 //ETX
00149 
00150 //BTX
00152 
00154   vtkStdString* GetPointer(vtkIdType id) { return this->Array + id; }
00155   void* GetVoidPointer(vtkIdType id) { return this->GetPointer(id); }
00157 //BTX
00158 
00161   void DeepCopy( vtkAbstractArray* aa );
00162 
00163 
00164 //BTX
00166 
00172   void SetArray(vtkStdString* array, vtkIdType size, int save);
00173   void SetVoidArray(void* array, vtkIdType size, int save)
00174     { this->SetArray(static_cast<vtkStdString*>(array), size, save); }
00176 //ETX
00177 
00185   unsigned long GetActualMemorySize();
00186 
00187   void ConvertToContiguous(vtkDataArray **Data, vtkIdTypeArray **Offsets);
00188   void ConvertFromContiguous(vtkDataArray *Data, vtkIdTypeArray *Offsets);
00189 
00190 protected:
00191   vtkStringArray(vtkIdType numComp=1);
00192   ~vtkStringArray();
00193 
00194   vtkStdString* Array;   // pointer to data
00195   vtkStdString* ResizeAndExtend(vtkIdType sz);  // function to resize data
00196 
00197   int SaveUserArray;
00198 
00199 private:
00200   vtkStringArray(const vtkStringArray&);  // Not implemented.
00201   void operator=(const vtkStringArray&);  // Not implemented.
00202 };
00203 
00204 
00205 
00206 #endif

Generated on Mon Jan 21 23:07:18 2008 for VTK by  doxygen 1.4.3-20050530