VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
47 class VTKCOMMONCORE_EXPORT vtkVariantArray : public vtkAbstractArray
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 
99  virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
100 
105 
108  virtual void *GetVoidPointer(vtkIdType id);
109 
112  virtual void DeepCopy(vtkAbstractArray *da);
113 
115 
119  virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
120  vtkAbstractArray* source, double* weights);
122 
124 
129  virtual void InterpolateTuple(vtkIdType i,
130  vtkIdType id1, vtkAbstractArray* source1,
131  vtkIdType id2, vtkAbstractArray* source2, double t);
133 
136  virtual void Squeeze();
137 
140  virtual int Resize(vtkIdType numTuples);
141 
143 
149  virtual void SetVoidArray(void *arr,
150  vtkIdType size,
151  int save);
153 
160  virtual unsigned long GetActualMemorySize();
161 
164  virtual int IsNumeric();
165 
168  virtual vtkArrayIterator* NewIterator();
169 
170  //
171  // Additional functions
172  //
173 
175  vtkVariant & GetValue(vtkIdType id) const;
176 
179  void SetValue(vtkIdType id, vtkVariant value);
180 
184  void InsertValue(vtkIdType id, vtkVariant value);
185 
187  void SetVariantValue(vtkIdType idx, vtkVariant value);
188 
191  vtkIdType InsertNextValue(vtkVariant value);
192 
193  //BTX
196  vtkVariant* GetPointer(vtkIdType id);
197 
199 
200  void SetArray(vtkVariant* arr, vtkIdType size, int save);
201  //ETX
203 
207  void SetNumberOfValues(vtkIdType number);
208 
210  vtkIdType GetNumberOfValues() { return this->MaxId + 1; }
211 
213 
214  virtual vtkIdType LookupValue(vtkVariant value);
215  virtual void LookupValue(vtkVariant value, vtkIdList* ids);
217 
224  virtual void DataChanged();
225 
229  virtual void DataElementChanged(vtkIdType id);
230 
234  virtual void ClearLookup();
235 
238  ~vtkVariantArray();
239 
240 protected:
241  // Construct object with default tuple dimension (number of components) of 1.
242  vtkVariantArray(vtkIdType numComp=1);
243 
244  // Pointer to data
245  //BTX
247 
248  // Function to resize data
249  vtkVariant* ResizeAndExtend(vtkIdType sz);
250  //ETX
251 
253 
254 private:
255  vtkVariantArray(const vtkVariantArray&); // Not implemented.
256  void operator=(const vtkVariantArray&); // Not implemented.
257 
258  vtkVariantArrayLookup* Lookup;
259  void UpdateLookup();
260 };
261 
262 #endif
void PrintSelf(ostream &os, vtkIndent indent)
virtual int IsNumeric()=0
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
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
virtual void SetNumberOfTuples(vtkIdType number)=0
virtual int GetDataType()=0
int vtkIdType
Definition: vtkType.h:268
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
virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights)=0
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