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 -------------------------------------------------------------------------*/
36 #ifndef __vtkVariantArray_h
37 #define __vtkVariantArray_h
38 
39 #include "vtkAbstractArray.h"
40 #include "vtkVariant.h" // For variant type
41 
42 class vtkVariantArrayLookup;
43 
44 //BTX
46 namespace boost { namespace serialization { class access; } }
47 //ETX
48 
50 {
51 //BTX
53  friend class boost::serialization::access;
54 //ETX
55 
56 public:
57  static vtkVariantArray* New();
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
61  //
62  // Functions required by vtkAbstractArray
63  //
64 
67  virtual int Allocate(vtkIdType sz, vtkIdType ext=1000);
68 
70  virtual void Initialize();
71 
74  virtual int GetDataType();
75 
79  virtual int GetDataTypeSize();
80 
85  virtual int GetElementComponentSize();
86 
89  virtual void SetNumberOfTuples(vtkIdType number);
90 
96  virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
97 
101  virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
102 
107 
110  virtual void *GetVoidPointer(vtkIdType id);
111 
114  virtual void DeepCopy(vtkAbstractArray *da);
115 
117 
121  virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
122  vtkAbstractArray* source, double* weights);
124 
126 
131  virtual void InterpolateTuple(vtkIdType i,
132  vtkIdType id1, vtkAbstractArray* source1,
133  vtkIdType id2, vtkAbstractArray* source2, double t);
135 
138  virtual void Squeeze();
139 
142  virtual int Resize(vtkIdType numTuples);
143 
145 
151  virtual void SetVoidArray(void *arr,
152  vtkIdType size,
153  int save);
155 
162  virtual unsigned long GetActualMemorySize();
163 
166  virtual int IsNumeric();
167 
170  virtual vtkArrayIterator* NewIterator();
171 
172  //
173  // Additional functions
174  //
175 
177  vtkVariant & GetValue(vtkIdType id) const;
178 
181  void SetValue(vtkIdType id, vtkVariant value);
182 
186  void InsertValue(vtkIdType id, vtkVariant value);
187 
189  void SetVariantValue(vtkIdType idx, vtkVariant value);
190 
193  vtkIdType InsertNextValue(vtkVariant value);
194 
195  //BTX
198  vtkVariant* GetPointer(vtkIdType id);
199 
201 
202  void SetArray(vtkVariant* arr, vtkIdType size, int save);
203  //ETX
205 
209  void SetNumberOfValues(vtkIdType number);
210 
212  vtkIdType GetNumberOfValues() { return this->MaxId + 1; }
213 
215 
216  virtual vtkIdType LookupValue(vtkVariant value);
217  virtual void LookupValue(vtkVariant value, vtkIdList* ids);
219 
226  virtual void DataChanged();
227 
231  virtual void DataElementChanged(vtkIdType id);
232 
236  virtual void ClearLookup();
237 
240  ~vtkVariantArray();
241 
242 protected:
243  // Construct object with default tuple dimension (number of components) of 1.
244  vtkVariantArray(vtkIdType numComp=1);
245 
246  // Pointer to data
247  //BTX
249 
250  // Function to resize data
251  vtkVariant* ResizeAndExtend(vtkIdType sz);
252  //ETX
253 
255 
256 private:
257  vtkVariantArray(const vtkVariantArray&); // Not implemented.
258  void operator=(const vtkVariantArray&); // Not implemented.
259 
260  vtkVariantArrayLookup* Lookup;
261  void UpdateLookup();
262 };
263 
264 #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:255
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:72
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:37
vtkVariant * Array
list of point or cell ids
Definition: vtkIdList.h:34
virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
virtual int Resize(vtkIdType numTuples)=0
virtual vtkArrayIterator * NewIterator()=0
#define VTK_COMMON_EXPORT
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
void save(Archiver &ar, const vtkVariant &variant, const unsigned int vtkNotUsed(version))
virtual unsigned long GetActualMemorySize()=0
virtual void Squeeze()=0
virtual void SetVariantValue(vtkIdType idx, vtkVariant value)=0
static vtkObject * New()
virtual int GetElementComponentSize()=0