VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Common/Core/vtkVariantArray.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkVariantArray.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00033 #ifndef vtkVariantArray_h
00034 #define vtkVariantArray_h
00035 
00036 #include "vtkCommonCoreModule.h" // For export macro
00037 #include "vtkAbstractArray.h"
00038 #include "vtkVariant.h" // For variant type
00039 
00040 class vtkVariantArrayLookup;
00041 
00042 //BTX
00044 namespace boost { namespace serialization { class access; } }
00045 //ETX
00046 
00047 class VTKCOMMONCORE_EXPORT vtkVariantArray : public vtkAbstractArray
00048 {
00049 //BTX
00051   friend class boost::serialization::access;
00052 //ETX
00053 
00054 public:
00055   static vtkVariantArray* New();
00056   vtkTypeMacro(vtkVariantArray,vtkAbstractArray);
00057   void PrintSelf(ostream& os, vtkIndent indent);
00058 
00059   //
00060   // Functions required by vtkAbstractArray
00061   //
00062 
00065   virtual int Allocate(vtkIdType sz, vtkIdType ext=1000);
00066 
00068   virtual void Initialize();
00069 
00072   virtual int GetDataType();
00073 
00077   virtual int GetDataTypeSize();
00078 
00083   virtual int GetElementComponentSize();
00084 
00087   virtual void SetNumberOfTuples(vtkIdType number);
00088 
00094   virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
00095 
00099   virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source);
00100 
00102 
00105   virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds,
00106                             vtkAbstractArray *source);
00108 
00110 
00113   virtual void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart,
00114                             vtkAbstractArray* source);
00116 
00120   virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray* source);
00121 
00124   virtual void *GetVoidPointer(vtkIdType id);
00125 
00128   virtual void DeepCopy(vtkAbstractArray *da);
00129 
00131 
00135   virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
00136     vtkAbstractArray* source,  double* weights);
00138 
00140 
00145   virtual void InterpolateTuple(vtkIdType i,
00146     vtkIdType id1, vtkAbstractArray* source1,
00147     vtkIdType id2, vtkAbstractArray* source2, double t);
00149 
00152   virtual void Squeeze();
00153 
00156   virtual int Resize(vtkIdType numTuples);
00157 
00159 
00165   virtual void SetVoidArray(void *arr,
00166                             vtkIdType size,
00167                             int save);
00169 
00176   virtual unsigned long GetActualMemorySize();
00177 
00180   virtual int IsNumeric();
00181 
00184   virtual vtkArrayIterator* NewIterator();
00185 
00186   //
00187   // Additional functions
00188   //
00189 
00191   vtkVariant & GetValue(vtkIdType id) const;
00192 
00195   void SetValue(vtkIdType id, vtkVariant value);
00196 
00200   void InsertValue(vtkIdType id, vtkVariant value);
00201 
00203   void SetVariantValue(vtkIdType idx, vtkVariant value);
00204 
00207   vtkIdType InsertNextValue(vtkVariant value);
00208 
00209   //BTX
00212   vtkVariant* GetPointer(vtkIdType id);
00213 
00215 
00216   void SetArray(vtkVariant* arr, vtkIdType size, int save);
00217   //ETX
00219 
00223   void SetNumberOfValues(vtkIdType number);
00224 
00226   vtkIdType GetNumberOfValues() { return this->MaxId + 1; }
00227 
00229 
00230   virtual vtkIdType LookupValue(vtkVariant value);
00231   virtual void LookupValue(vtkVariant value, vtkIdList* ids);
00233 
00240   virtual void DataChanged();
00241 
00245   virtual void DataElementChanged(vtkIdType id);
00246 
00250   virtual void ClearLookup();
00251 
00254   ~vtkVariantArray();
00255 
00256 protected:
00257   // Construct object with default tuple dimension (number of components) of 1.
00258   vtkVariantArray();
00259 
00260   // Pointer to data
00261   //BTX
00262   vtkVariant* Array;
00263 
00264   // Function to resize data
00265   vtkVariant* ResizeAndExtend(vtkIdType sz);
00266   //ETX
00267 
00268   int SaveUserArray;
00269 
00270 private:
00271   vtkVariantArray(const vtkVariantArray&);  // Not implemented.
00272   void operator=(const vtkVariantArray&);  // Not implemented.
00273 
00274   vtkVariantArrayLookup* Lookup;
00275   void UpdateLookup();
00276 };
00277 
00278 #endif