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
51  friend class boost::serialization::access;
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 
110 
113  virtual void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart,
116 
121 
124  virtual void *GetVoidPointer(vtkIdType id);
125 
128  virtual void DeepCopy(vtkAbstractArray *da);
129 
131 
135  virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
136  vtkAbstractArray* source, double* weights);
138 
140 
145  virtual void InterpolateTuple(vtkIdType i,
146  vtkIdType id1, vtkAbstractArray* source1,
147  vtkIdType id2, vtkAbstractArray* source2, double t);
149 
152  virtual void Squeeze();
153 
156  virtual int Resize(vtkIdType numTuples);
157 
159 
165  virtual void SetVoidArray(void *arr,
166  vtkIdType size,
167  int save);
169 
176  virtual unsigned long GetActualMemorySize();
177 
180  virtual int IsNumeric();
181 
184  virtual vtkArrayIterator* NewIterator();
185 
186  //
187  // Additional functions
188  //
189 
191  vtkVariant & GetValue(vtkIdType id) const;
192 
195  void SetValue(vtkIdType id, vtkVariant value);
196 
200  void InsertValue(vtkIdType id, vtkVariant value);
201 
204 
207 
210  vtkIdType InsertNextValue(vtkVariant value);
211 
212  //BTX
215  vtkVariant* GetPointer(vtkIdType id);
216 
218 
219  void SetArray(vtkVariant* arr, vtkIdType size, int save);
220  //ETX
222 
226  void SetNumberOfValues(vtkIdType number);
227 
229  vtkIdType GetNumberOfValues() { return this->MaxId + 1; }
230 
232 
234  virtual void LookupValue(vtkVariant value, vtkIdList* ids);
236 
243  virtual void DataChanged();
244 
248  virtual void DataElementChanged(vtkIdType id);
249 
253  virtual void ClearLookup();
254 
257  ~vtkVariantArray();
258 
259 protected:
260  // Construct object with default tuple dimension (number of components) of 1.
261  vtkVariantArray();
262 
263  // Pointer to data
264  //BTX
266 
267  // Function to resize data
268  vtkVariant* ResizeAndExtend(vtkIdType sz);
269  //ETX
270 
272 
273 private:
274  vtkVariantArray(const vtkVariantArray&); // Not implemented.
275  void operator=(const vtkVariantArray&); // Not implemented.
276 
277  vtkVariantArrayLookup* Lookup;
278  void UpdateLookup();
279 };
280 
281 #endif
void PrintSelf(ostream &os, vtkIndent indent)
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
#define VTKCOMMONCORE_EXPORT
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
virtual void SetNumberOfTuples(vtkIdType number)=0
virtual int GetDataType()=0
virtual void InsertVariantValue(vtkIdType idx, vtkVariant value)=0
int vtkIdType
Definition: vtkType.h:247
virtual void SetVoidArray(void *vtkNotUsed(array), vtkIdType vtkNotUsed(size), int vtkNotUsed(save))=0
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()
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