VTK
|
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 00074 void Dump( unsigned int colWidth = 16 ); 00075 00077 int GetDataObjectType() {return VTK_TABLE;} 00078 00084 virtual unsigned long GetActualMemorySize(); 00085 00087 00088 vtkGetObjectMacro(RowData, vtkDataSetAttributes); 00089 virtual void SetRowData(vtkDataSetAttributes* data); 00091 00092 // 00093 // Row functions 00094 // 00095 00097 vtkIdType GetNumberOfRows(); 00098 00102 void SetNumberOfRows(const vtkIdType ); 00103 00106 vtkVariantArray* GetRow(vtkIdType row); 00107 00110 void GetRow(vtkIdType row, vtkVariantArray *values); 00111 00114 void SetRow(vtkIdType row, vtkVariantArray *values); 00115 00117 vtkIdType InsertNextBlankRow(double default_num_val=0.0); 00118 00121 vtkIdType InsertNextRow(vtkVariantArray* arr); 00122 00125 void RemoveRow(vtkIdType row); 00126 00127 // 00128 // Column functions 00129 // 00130 00132 vtkIdType GetNumberOfColumns(); 00133 00134 // Get the name of a column of the table. 00135 const char* GetColumnName(vtkIdType col); 00136 00138 vtkAbstractArray* GetColumnByName(const char* name); 00139 00141 vtkAbstractArray* GetColumn(vtkIdType col); 00142 00144 void AddColumn(vtkAbstractArray* arr); 00145 00147 void RemoveColumnByName(const char* name); 00148 00150 void RemoveColumn(vtkIdType col); 00151 00152 // 00153 // Table single entry functions 00154 // 00155 00156 //BTX 00161 vtkVariant GetValue(vtkIdType row, vtkIdType col); 00162 00165 vtkVariant GetValueByName(vtkIdType row, const char* col); 00166 00168 void SetValue(vtkIdType row, vtkIdType col, vtkVariant value); 00169 00171 00172 void SetValueByName(vtkIdType row, const char* col, vtkVariant value); 00173 //ETX 00175 00177 virtual void Initialize(); 00178 00180 00181 static vtkTable* GetData(vtkInformation* info); 00182 static vtkTable* GetData(vtkInformationVector* v, int i=0); 00184 00186 00187 virtual void ShallowCopy(vtkDataObject* src); 00188 virtual void DeepCopy(vtkDataObject* src); 00190 00195 virtual vtkFieldData* GetAttributesAsFieldData(int type); 00196 00198 virtual vtkIdType GetNumberOfElements(int type); 00199 00200 protected: 00201 vtkTable(); 00202 ~vtkTable(); 00203 00205 vtkDataSetAttributes* RowData; 00206 00208 vtkVariantArray* RowArray; 00209 00210 private: 00211 vtkTable(const vtkTable&); // Not implemented 00212 void operator=(const vtkTable&); // Not implemented 00213 }; 00214 00215 #endif 00216