VTK  9.2.6
vtkTable.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTable.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 -------------------------------------------------------------------------*/
62 #ifndef vtkTable_h
63 #define vtkTable_h
64 
65 #include "vtkCommonDataModelModule.h" // For export macro
66 #include "vtkDataObject.h"
67 
68 class vtkAbstractArray;
70 class vtkVariant;
71 class vtkVariantArray;
72 
73 class VTKCOMMONDATAMODEL_EXPORT vtkTable : public vtkDataObject
74 {
75 public:
76  static vtkTable* New();
77  static vtkTable* ExtendedNew();
78  vtkTypeMacro(vtkTable, vtkDataObject);
79  void PrintSelf(ostream& os, vtkIndent indent) override;
80 
87  void Dump(unsigned int colWidth = 16, int rowLimit = -1);
88 
92  int GetDataObjectType() override { return VTK_TABLE; }
93 
101  unsigned long GetActualMemorySize() override;
102 
104 
107  vtkGetObjectMacro(RowData, vtkDataSetAttributes);
108  virtual void SetRowData(vtkDataSetAttributes* data);
110 
111  //
112  // Row functions
113  //
114 
118  vtkIdType GetNumberOfRows();
119 
125  void SetNumberOfRows(const vtkIdType);
126 
130  void SqueezeRows();
131 
136  vtkVariantArray* GetRow(vtkIdType row);
137 
141  void GetRow(vtkIdType row, vtkVariantArray* values);
142 
146  void SetRow(vtkIdType row, vtkVariantArray* values);
147 
151  void InsertRow(vtkIdType row);
152 
156  void InsertRows(vtkIdType row, vtkIdType n);
157 
161  vtkIdType InsertNextBlankRow(double default_num_val = 0.0);
162 
167  vtkIdType InsertNextRow(vtkVariantArray* values);
168 
172  void RemoveRow(vtkIdType row);
173 
177  void RemoveRows(vtkIdType row, vtkIdType n);
178 
183  void RemoveAllRows();
184 
185  //
186  // Column functions
187  //
188 
192  vtkIdType GetNumberOfColumns();
193 
194  // Get the name of a column of the table.
195  const char* GetColumnName(vtkIdType col);
196 
200  vtkAbstractArray* GetColumnByName(const char* name);
201 
206  vtkIdType GetColumnIndex(const char* name);
207 
211  vtkAbstractArray* GetColumn(vtkIdType col);
212 
216  void AddColumn(vtkAbstractArray* arr);
217 
221  void InsertColumn(vtkAbstractArray* arr, vtkIdType index);
222 
226  void RemoveColumnByName(const char* name);
227 
231  void RemoveColumn(vtkIdType col);
232 
236  void RemoveAllColumns();
237 
238  //
239  // Table single entry functions
240  //
241 
248  vtkVariant GetValue(vtkIdType row, vtkIdType col);
249 
253  vtkVariant GetValueByName(vtkIdType row, const char* col);
254 
258  void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
259 
263  void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
264 
268  void Initialize() override;
269 
271 
275  static vtkTable* GetData(vtkInformationVector* v, int i = 0);
277 
279 
282  void ShallowCopy(vtkDataObject* src) override;
283  void DeepCopy(vtkDataObject* src) override;
285 
293 
297  vtkIdType GetNumberOfElements(int type) override;
298 
299 protected:
300  vtkTable();
301  ~vtkTable() override;
302 
307 
312 
318  void MoveRowData(vtkIdType first, vtkIdType last, vtkIdType delta);
319 
320 private:
321  vtkTable(const vtkTable&) = delete;
322  void operator=(const vtkTable&) = delete;
323 };
324 
325 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
virtual vtkFieldData * GetAttributesAsFieldData(int type)
Returns the attributes of the data object as a vtkFieldData.
static vtkDataObject * New()
An array holding vtkVariants.
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
#define VTK_TABLE
Definition: vtkType.h:96
virtual void Initialize()
Restore data object to initial state,.
int vtkIdType
Definition: vtkType.h:332
A atomic type representing the union of many types.
Definition: vtkVariant.h:69
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTable.h:92
vtkVariantArray * RowArray
Holds row information returned by GetRow().
Definition: vtkTable.h:311
a simple class to control print indentation
Definition: vtkIndent.h:39
represent and manipulate attribute data in a dataset
virtual unsigned long GetActualMemorySize()
Return the actual size of the data in kibibytes (1024 bytes).
virtual vtkIdType GetNumberOfElements(int type)
Get the number of elements for a specific attribute type (POINT, CELL, etc.).
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:73
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:65
vtkDataSetAttributes * RowData
Holds the column data of the table.
Definition: vtkTable.h:306
virtual void DeepCopy(vtkDataObject *src)
Shallow and Deep copy.
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.
represent and manipulate fields of data
Definition: vtkFieldData.h:62