VTK
dox/Filtering/vtkTable.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTable.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 -------------------------------------------------------------------------*/
00056 #ifndef __vtkTable_h
00057 #define __vtkTable_h
00058 
00059 #include "vtkDataObject.h"
00060 
00061 class vtkAbstractArray;
00062 class vtkDataSetAttributes;
00063 class vtkVariant;
00064 class vtkVariantArray;
00065 
00066 class VTK_FILTERING_EXPORT vtkTable : public vtkDataObject
00067 {
00068 public:
00069   static vtkTable* New();
00070   vtkTypeMacro(vtkTable, vtkDataObject);
00071   void PrintSelf(ostream &os, vtkIndent indent);
00072 
00077   void Dump( unsigned int colWidth = 16, int rowLimit = -1 );
00078 
00080   int GetDataObjectType() {return VTK_TABLE;}
00081 
00087   virtual unsigned long GetActualMemorySize();
00088 
00090 
00091   vtkGetObjectMacro(RowData, vtkDataSetAttributes);
00092   virtual void SetRowData(vtkDataSetAttributes* data);
00094 
00095   //
00096   // Row functions
00097   //
00098 
00100   vtkIdType GetNumberOfRows();
00101 
00105   void SetNumberOfRows(const vtkIdType );
00106 
00109   vtkVariantArray* GetRow(vtkIdType row);
00110 
00113   void GetRow(vtkIdType row, vtkVariantArray *values);
00114 
00117   void SetRow(vtkIdType row, vtkVariantArray *values);
00118 
00120   vtkIdType InsertNextBlankRow(double default_num_val=0.0);
00121 
00124   vtkIdType InsertNextRow(vtkVariantArray* arr);
00125 
00128   void RemoveRow(vtkIdType row);
00129 
00130   //
00131   // Column functions
00132   //
00133 
00135   vtkIdType GetNumberOfColumns();
00136 
00137   // Get the name of a column of the table.
00138   const char* GetColumnName(vtkIdType col);
00139 
00141   vtkAbstractArray* GetColumnByName(const char* name);
00142 
00144   vtkAbstractArray* GetColumn(vtkIdType col);
00145 
00147   void AddColumn(vtkAbstractArray* arr);
00148 
00150   void RemoveColumnByName(const char* name);
00151 
00153   void RemoveColumn(vtkIdType col);
00154 
00155   //
00156   // Table single entry functions
00157   //
00158 
00163   vtkVariant GetValue(vtkIdType row, vtkIdType col);
00164 
00167   vtkVariant GetValueByName(vtkIdType row, const char* col);
00168 
00170   void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
00171 
00173   void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
00174   
00176   virtual void Initialize();
00177 
00179 
00180   static vtkTable* GetData(vtkInformation* info);
00181   static vtkTable* GetData(vtkInformationVector* v, int i=0);
00183 
00185 
00186   virtual void ShallowCopy(vtkDataObject* src);
00187   virtual void DeepCopy(vtkDataObject* src);
00189 
00194   virtual vtkFieldData* GetAttributesAsFieldData(int type);
00195 
00197   virtual vtkIdType GetNumberOfElements(int type);
00198 
00199 protected:
00200   vtkTable();
00201   ~vtkTable();
00202 
00204   vtkDataSetAttributes* RowData;
00205 
00207   vtkVariantArray* RowArray;
00208 
00209 private:
00210   vtkTable(const vtkTable&); // Not implemented
00211   void operator=(const vtkTable&); // Not implemented
00212 };
00213 
00214 #endif
00215