VTK  9.3.1
vtkTable.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
46 #ifndef vtkTable_h
47 #define vtkTable_h
48 
49 #include "vtkCommonDataModelModule.h" // For export macro
50 #include "vtkDataObject.h"
51 
52 VTK_ABI_NAMESPACE_BEGIN
53 class vtkAbstractArray;
55 class vtkVariant;
56 class vtkVariantArray;
57 
58 class VTKCOMMONDATAMODEL_EXPORT vtkTable : public vtkDataObject
59 {
60 public:
61  static vtkTable* New();
62  static vtkTable* ExtendedNew();
63  vtkTypeMacro(vtkTable, vtkDataObject);
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
72  void Dump(unsigned int colWidth = 16, int rowLimit = -1);
73 
77  int GetDataObjectType() override { return VTK_TABLE; }
78 
86  unsigned long GetActualMemorySize() override;
87 
89 
92  vtkGetObjectMacro(RowData, vtkDataSetAttributes);
93  virtual void SetRowData(vtkDataSetAttributes* data);
95 
96  //
97  // Row functions
98  //
99 
103  vtkIdType GetNumberOfRows();
104 
110  void SetNumberOfRows(vtkIdType);
111 
115  void SqueezeRows();
116 
121  vtkVariantArray* GetRow(vtkIdType row);
122 
126  void GetRow(vtkIdType row, vtkVariantArray* values);
127 
131  void SetRow(vtkIdType row, vtkVariantArray* values);
132 
136  void InsertRow(vtkIdType row);
137 
141  void InsertRows(vtkIdType row, vtkIdType n);
142 
146  vtkIdType InsertNextBlankRow(double default_num_val = 0.0);
147 
152  vtkIdType InsertNextRow(vtkVariantArray* values);
153 
157  void RemoveRow(vtkIdType row);
158 
162  void RemoveRows(vtkIdType row, vtkIdType n);
163 
168  void RemoveAllRows();
169 
170  //
171  // Column functions
172  //
173 
177  vtkIdType GetNumberOfColumns();
178 
179  // Get the name of a column of the table.
180  const char* GetColumnName(vtkIdType col);
181 
185  vtkAbstractArray* GetColumnByName(const char* name);
186 
191  vtkIdType GetColumnIndex(const char* name);
192 
196  vtkAbstractArray* GetColumn(vtkIdType col);
197 
201  void AddColumn(vtkAbstractArray* arr);
202 
206  void InsertColumn(vtkAbstractArray* arr, vtkIdType index);
207 
211  void RemoveColumnByName(const char* name);
212 
216  void RemoveColumn(vtkIdType col);
217 
221  void RemoveAllColumns();
222 
223  //
224  // Table single entry functions
225  //
226 
233  vtkVariant GetValue(vtkIdType row, vtkIdType col);
234 
238  vtkVariant GetValueByName(vtkIdType row, const char* col);
239 
243  void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
244 
248  void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
249 
253  void Initialize() override;
254 
256 
260  static vtkTable* GetData(vtkInformationVector* v, int i = 0);
262 
264 
267  void ShallowCopy(vtkDataObject* src) override;
268  void DeepCopy(vtkDataObject* src) override;
270 
278 
282  vtkIdType GetNumberOfElements(int type) override;
283 
284 protected:
285  vtkTable();
286  ~vtkTable() override;
287 
292 
297 
303  void MoveRowData(vtkIdType first, vtkIdType last, vtkIdType delta);
304 
305 private:
306  vtkTable(const vtkTable&) = delete;
307  void operator=(const vtkTable&) = delete;
308 };
309 
310 VTK_ABI_NAMESPACE_END
311 #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:84
virtual void Initialize()
Restore data object to initial state,.
int vtkIdType
Definition: vtkType.h:315
A type representing the union of many types.
Definition: vtkVariant.h:52
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTable.h:77
vtkVariantArray * RowArray
Holds row information returned by GetRow().
Definition: vtkTable.h:296
a simple class to control print indentation
Definition: vtkIndent.h:28
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:58
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:54
vtkDataSetAttributes * RowData
Holds the column data of the table.
Definition: vtkTable.h:291
virtual void DeepCopy(vtkDataObject *src)
The goal of the method is to copy the complete data from src into this object.
virtual void ShallowCopy(vtkDataObject *src)
The goal of the method is to copy the data up to the array pointers only.
represent and manipulate fields of data
Definition: vtkFieldData.h:51