VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkStringArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStringArray.h
5  Language: C++
6 
7  Copyright 2004 Sandia Corporation.
8  Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9  license for use of this work by or on behalf of the
10  U.S. Government. Redistribution and use in source and binary forms, with
11  or without modification, are permitted provided that this Notice and any
12  statement of authorship are reproduced on all copies.
13 
14 =========================================================================*/
15 
35 #ifndef __vtkStringArray_h
36 #define __vtkStringArray_h
37 
38 #include "vtkCommonCoreModule.h" // For export macro
39 #include "vtkAbstractArray.h"
40 #include "vtkStdString.h" // needed for vtkStdString definition
41 
42 class vtkStringArrayLookup;
43 
45 {
46 public:
47  static vtkStringArray* New();
49  void PrintSelf(ostream& os, vtkIndent indent);
50 
51  //
52  //
53  // Functions required by vtkAbstractArray
54  //
55  //
56 
58 
60  { return VTK_STRING; }
62 
63  int IsNumeric() { return 0; }
64 
66  void Initialize();
67 
71  int GetDataTypeSize();
72 
75  void Squeeze() { this->ResizeAndExtend (this->MaxId+1); }
76 
78  int Resize(vtkIdType numTuples);
79 
85  virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
86 
91 
93 
96  virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds,
99 
104 
106 
110  virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
111  vtkAbstractArray* source, double* weights);
113 
115 
120  virtual void InterpolateTuple(vtkIdType i,
121  vtkIdType id1, vtkAbstractArray* source1,
122  vtkIdType id2, vtkAbstractArray* source2, double t);
124 
129  virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output);
130 
135  virtual void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
136 
139  int Allocate( vtkIdType sz, vtkIdType ext=1000 );
140 
142  vtkStdString &GetValue(vtkIdType id);
143 
144 //BTX
146 
149  { this->Array[id] = value; this->DataChanged(); }
150 //ETX
151  void SetValue(vtkIdType id, const char *value);
153 
155 
157  virtual void SetNumberOfTuples(vtkIdType number)
158  { this->SetNumberOfValues(this->NumberOfComponents* number); }
160 
164  void SetNumberOfValues(vtkIdType number);
165 
166  vtkIdType GetNumberOfValues() { return this->MaxId + 1; }
167 
168  int GetNumberOfElementComponents() { return 0; }
169  int GetElementComponentSize() { return static_cast<int>(sizeof(vtkStdString::value_type)); }
170 
171 //BTX
173 
174  void InsertValue(vtkIdType id, vtkStdString f);
175 //ETX
176  void InsertValue(vtkIdType id, const char *val);
178 
182 
183 //BTX
185 
187  vtkIdType InsertNextValue(vtkStdString f);
188 //ETX
189  vtkIdType InsertNextValue(const char *f);
191 
192 //BTX
194 
197  vtkStdString* WritePointer(vtkIdType id, vtkIdType number);
198 //ETX
200 
201 //BTX
203 
205  vtkStdString* GetPointer(vtkIdType id) { return this->Array + id; }
206  void* GetVoidPointer(vtkIdType id) { return this->GetPointer(id); }
207 //ETX
209 
212  void DeepCopy( vtkAbstractArray* aa );
213 
214 
215 //BTX
217 
226  void SetArray(vtkStdString* array, vtkIdType size, int save);
227  virtual void SetVoidArray(void* array, vtkIdType size, int save)
228  { this->SetArray(static_cast<vtkStdString*>(array), size, save); }
229 //ETX
231 
239  unsigned long GetActualMemorySize();
240 
242  virtual vtkArrayIterator* NewIterator();
243 
248  virtual vtkIdType GetDataSize();
249 
251 
253  virtual void LookupValue(vtkVariant value, vtkIdList* ids);
254 //BTX
257 //ETX
258  vtkIdType LookupValue(const char* value);
259  void LookupValue(const char* value, vtkIdList* ids);
261 
268  virtual void DataChanged();
269 
273  virtual void DataElementChanged(vtkIdType id);
274 
278  virtual void ClearLookup();
279 
280 protected:
281  vtkStringArray();
282  ~vtkStringArray();
283 
284  vtkStdString* Array; // pointer to data
285  vtkStdString* ResizeAndExtend(vtkIdType sz); // function to resize data
286 
288 
289 private:
290  vtkStringArray(const vtkStringArray&); // Not implemented.
291  void operator=(const vtkStringArray&); // Not implemented.
292 
293  //BTX
294  vtkStringArrayLookup* Lookup;
295  void UpdateLookup();
296  //ETX
297 };
298 
299 
300 
301 #endif
void PrintSelf(ostream &os, vtkIndent indent)
vtkIdType GetNumberOfValues()
GLsizeiptr size
Definition: vtkgl.h:11843
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
GLclampf f
Definition: vtkgl.h:14181
virtual void DataChanged()=0
vtkStdString * GetPointer(vtkIdType id)
virtual void DeepCopy(vtkAbstractArray *da)
Abstract superclass for all arrays.
virtual vtkIdType LookupValue(vtkVariant value)=0
virtual int GetDataTypeSize()=0
vtkStdString * Array
#define VTKCOMMONCORE_EXPORT
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
a vtkAbstractArray subclass for strings
virtual void SetVoidArray(void *array, vtkIdType size, int save)
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
int vtkIdType
Definition: vtkType.h:268
GLdouble GLdouble t
Definition: vtkgl.h:11602
GLuint * ids
Definition: vtkgl.h:11831
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
virtual void Initialize()=0
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
void SetValue(vtkIdType id, vtkStdString value)
#define VTK_STRING
Definition: vtkType.h:41
virtual vtkIdType GetDataSize()
virtual int Allocate(vtkIdType sz, vtkIdType ext=1000)=0
const GLbyte * weights
Definition: vtkgl.h:12766
virtual void ClearLookup()=0
a simple class to control print indentation
Definition: vtkIndent.h:38
list of point or cell ids
Definition: vtkIdList.h:35
virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
virtual int Resize(vtkIdType numTuples)=0
virtual vtkArrayIterator * NewIterator()=0
virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output)
Abstract superclass to iterate over elements in an vtkAbstractArray.
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))
virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights)=0
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
virtual void SetNumberOfTuples(vtkIdType number)
virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
StdString::value_type value_type
Definition: vtkStdString.h:51
void * GetVoidPointer(vtkIdType id)
virtual unsigned long GetActualMemorySize()=0
virtual void SetVariantValue(vtkIdType idx, vtkVariant value)=0
static vtkObject * New()
GLuint id
Definition: vtkgl.h:11834
virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source)=0
int GetElementComponentSize()
GLuint GLfloat * val
Definition: vtkgl.h:13789
int GetNumberOfElementComponents()