VTK
vtkVariantArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVariantArray.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
33 #ifndef __vtkVariantArray_h
34 #define __vtkVariantArray_h
35 
36 #include "vtkCommonCoreModule.h" // For export macro
37 #include "vtkAbstractArray.h"
38 #include "vtkVariant.h" // For variant type
39 
40 class vtkVariantArrayLookup;
41 
42 //BTX
44 namespace boost { namespace serialization { class access; } }
45 //ETX
46 
48 {
49 //BTX
52 //ETX
53 
54 public:
55  static vtkVariantArray* New();
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
59  //
60  // Functions required by vtkAbstractArray
61  //
62 
65  virtual int Allocate(vtkIdType sz, vtkIdType ext=1000);
66 
68  virtual void Initialize();
69 
72  virtual int GetDataType();
73 
77  virtual int GetDataTypeSize();
78 
83  virtual int GetElementComponentSize();
84 
87  virtual void SetNumberOfTuples(vtkIdType number);
88 
94  virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
95 
100 
102 
105  virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds,
108 
113 
116  virtual void *GetVoidPointer(vtkIdType id);
117 
120  virtual void DeepCopy(vtkAbstractArray *da);
121 
123 
127  virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
128  vtkAbstractArray* source, double* weights);
130 
132 
137  virtual void InterpolateTuple(vtkIdType i,
138  vtkIdType id1, vtkAbstractArray* source1,
139  vtkIdType id2, vtkAbstractArray* source2, double t);
141 
144  virtual void Squeeze();
145 
148  virtual int Resize(vtkIdType numTuples);
149 
151 
157  virtual void SetVoidArray(void *arr,
158  vtkIdType size,
159  int save);
161 
168  virtual unsigned long GetActualMemorySize();
169 
172  virtual int IsNumeric();
173 
176  virtual vtkArrayIterator* NewIterator();
177 
178  //
179  // Additional functions
180  //
181 
183  vtkVariant & GetValue(vtkIdType id) const;
184 
187  void SetValue(vtkIdType id, vtkVariant value);
188 
192  void InsertValue(vtkIdType id, vtkVariant value);
193 
196 
199  vtkIdType InsertNextValue(vtkVariant value);
200 
201  //BTX
204  vtkVariant* GetPointer(vtkIdType id);
205 
207 
208  void SetArray(vtkVariant* arr, vtkIdType size, int save);
209  //ETX
211 
215  void SetNumberOfValues(vtkIdType number);
216 
218  vtkIdType GetNumberOfValues() { return this->MaxId + 1; }
219 
221 
223  virtual void LookupValue(vtkVariant value, vtkIdList* ids);
225 
232  virtual void DataChanged();
233 
237  virtual void DataElementChanged(vtkIdType id);
238 
242  virtual void ClearLookup();
243 
246  ~vtkVariantArray();
247 
248 protected:
249  // Construct object with default tuple dimension (number of components) of 1.
250  vtkVariantArray();
251 
252  // Pointer to data
253  //BTX
255 
256  // Function to resize data
257  vtkVariant* ResizeAndExtend(vtkIdType sz);
258  //ETX
259 
261 
262 private:
263  vtkVariantArray(const vtkVariantArray&); // Not implemented.
264  void operator=(const vtkVariantArray&); // Not implemented.
265 
266  vtkVariantArrayLookup* Lookup;
267  void UpdateLookup();
268 };
269 
270 #endif
void PrintSelf(ostream &os, vtkIndent indent)
GLsizeiptr size
Definition: vtkgl.h:11843
virtual int IsNumeric()=0
Forward declaration required for Boost serialization.
virtual void DataChanged()=0
virtual void DeepCopy(vtkAbstractArray *da)
An array holding vtkVariants.
Abstract superclass for all arrays.
virtual vtkIdType LookupValue(vtkVariant value)=0
virtual int GetDataTypeSize()=0
GLenum access
Definition: vtkgl.h:18860
#define VTKCOMMONCORE_EXPORT
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
virtual void SetNumberOfTuples(vtkIdType number)=0
virtual int GetDataType()=0
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
virtual void SetVoidArray(void *vtkNotUsed(array), vtkIdType vtkNotUsed(size), int vtkNotUsed(save))=0
#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
virtual int Allocate(vtkIdType sz, vtkIdType ext=1000)=0
vtkIdType GetNumberOfValues()
const GLbyte * weights
Definition: vtkgl.h:12766
virtual void ClearLookup()=0
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkVariant * Array
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
Abstract superclass to iterate over elements in an vtkAbstractArray.
virtual void * GetVoidPointer(vtkIdType id)=0
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 vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
virtual unsigned long GetActualMemorySize()=0
virtual void Squeeze()=0
virtual void SetVariantValue(vtkIdType idx, vtkVariant value)=0
static vtkObject * New()
virtual int GetElementComponentSize()=0
virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source)=0