VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
52 
53 VTK_ABI_NAMESPACE_BEGIN
54 class vtkAbstractArray;
56 class vtkVariant;
57 class vtkVariantArray;
58 
59 class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALMANUAL vtkTable : public vtkDataObject
60 {
61 public:
62  static vtkTable* New();
63  static vtkTable* ExtendedNew();
64  vtkTypeMacro(vtkTable, vtkDataObject);
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
76  void Dump(unsigned int colWidth = 16, int rowLimit = -1, unsigned int indent = 0);
77 
81  int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_TABLE; }
82 
90  unsigned long GetActualMemorySize() override;
91 
93 
96  vtkGetObjectMacro(RowData, vtkDataSetAttributes);
97  virtual void SetRowData(vtkDataSetAttributes* data);
99 
100  //
101  // Row functions
102  //
103 
107  vtkIdType GetNumberOfRows();
108 
114  void SetNumberOfRows(vtkIdType);
115 
119  void SqueezeRows();
120 
125  vtkVariantArray* GetRow(vtkIdType row);
126 
130  void GetRow(vtkIdType row, vtkVariantArray* values);
131 
135  void SetRow(vtkIdType row, vtkVariantArray* values);
136 
140  void InsertRow(vtkIdType row);
141 
145  void InsertRows(vtkIdType row, vtkIdType n);
146 
150  vtkIdType InsertNextBlankRow(double default_num_val = 0.0);
151 
156  vtkIdType InsertNextRow(vtkVariantArray* values);
157 
161  void RemoveRow(vtkIdType row);
162 
166  void RemoveRows(vtkIdType row, vtkIdType n);
167 
172  void RemoveAllRows();
173 
174  //
175  // Column functions
176  //
177 
181  vtkIdType GetNumberOfColumns();
182 
183  // Get the name of a column of the table.
184  const char* GetColumnName(vtkIdType col);
185 
189  vtkAbstractArray* GetColumnByName(const char* name);
190 
195  vtkIdType GetColumnIndex(const char* name);
196 
200  vtkAbstractArray* GetColumn(vtkIdType col);
201 
205  void AddColumn(vtkAbstractArray* arr);
206 
210  void InsertColumn(vtkAbstractArray* arr, vtkIdType index);
211 
215  void RemoveColumnByName(const char* name);
216 
220  void RemoveColumn(vtkIdType col);
221 
225  void RemoveAllColumns();
226 
227  //
228  // Table single entry functions
229  //
230 
237  vtkVariant GetValue(vtkIdType row, vtkIdType col);
238 
242  vtkVariant GetValueByName(vtkIdType row, const char* col);
243 
247  void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
248 
252  void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
253 
257  void Initialize() override;
258 
260 
264  static vtkTable* GetData(vtkInformationVector* v, int i = 0);
266 
268 
271  void ShallowCopy(vtkDataObject* src) override;
272  void DeepCopy(vtkDataObject* src) override;
274 
282 
286  vtkIdType GetNumberOfElements(int type) override;
287 
288 protected:
289  vtkTable();
290  ~vtkTable() override;
291 
296 
301 
307  void MoveRowData(vtkIdType first, vtkIdType last, vtkIdType delta);
308 
309 private:
310  vtkTable(const vtkTable&) = delete;
311  void operator=(const vtkTable&) = delete;
312 };
313 
314 VTK_ABI_NAMESPACE_END
315 #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.
virtual void Initialize()
Restore data object to initial state,.
int vtkIdType
Definition: vtkType.h:363
A type representing the union of many types.
Definition: vtkVariant.h:52
vtkVariantArray * RowArray
Holds row information returned by GetRow().
Definition: vtkTable.h:300
int GetDataObjectType() VTK_FUTURE_CONST override
Return what type of dataset this is.
Definition: vtkTable.h:81
#define VTK_MARSHALMANUAL
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:59
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:55
vtkDataSetAttributes * RowData
Holds the column data of the table.
Definition: vtkTable.h:295
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.
Represents and manipulates a collection of data arrays.
Definition: vtkFieldData.h:51