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 "vtkCommonDataModelModule.h" // For export macro 00060 #include "vtkDataObject.h" 00061 00062 class vtkAbstractArray; 00063 class vtkDataSetAttributes; 00064 class vtkVariant; 00065 class vtkVariantArray; 00066 00067 class VTKCOMMONDATAMODEL_EXPORT vtkTable : public vtkDataObject 00068 { 00069 public: 00070 static vtkTable* New(); 00071 vtkTypeMacro(vtkTable, vtkDataObject); 00072 void PrintSelf(ostream &os, vtkIndent indent); 00073 00078 void Dump( unsigned int colWidth = 16, int rowLimit = -1 ); 00079 00081 int GetDataObjectType() {return VTK_TABLE;} 00082 00088 virtual unsigned long GetActualMemorySize(); 00089 00091 00092 vtkGetObjectMacro(RowData, vtkDataSetAttributes); 00093 virtual void SetRowData(vtkDataSetAttributes* data); 00095 00096 // 00097 // Row functions 00098 // 00099 00101 vtkIdType GetNumberOfRows(); 00102 00106 void SetNumberOfRows(const vtkIdType ); 00107 00110 vtkVariantArray* GetRow(vtkIdType row); 00111 00114 void GetRow(vtkIdType row, vtkVariantArray *values); 00115 00118 void SetRow(vtkIdType row, vtkVariantArray *values); 00119 00121 vtkIdType InsertNextBlankRow(double default_num_val=0.0); 00122 00125 vtkIdType InsertNextRow(vtkVariantArray* arr); 00126 00129 void RemoveRow(vtkIdType row); 00130 00131 // 00132 // Column functions 00133 // 00134 00136 vtkIdType GetNumberOfColumns(); 00137 00138 // Get the name of a column of the table. 00139 const char* GetColumnName(vtkIdType col); 00140 00142 vtkAbstractArray* GetColumnByName(const char* name); 00143 00145 vtkAbstractArray* GetColumn(vtkIdType col); 00146 00148 void AddColumn(vtkAbstractArray* arr); 00149 00151 void RemoveColumnByName(const char* name); 00152 00154 void RemoveColumn(vtkIdType col); 00155 00156 // 00157 // Table single entry functions 00158 // 00159 00164 vtkVariant GetValue(vtkIdType row, vtkIdType col); 00165 00168 vtkVariant GetValueByName(vtkIdType row, const char* col); 00169 00171 void SetValue(vtkIdType row, vtkIdType col, vtkVariant value); 00172 00174 void SetValueByName(vtkIdType row, const char* col, vtkVariant value); 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