VTK  9.0.20210126
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 -------------------------------------------------------------------------*/
51 #ifndef vtkTable_h
52 #define vtkTable_h
53 
54 #include "vtkCommonDataModelModule.h" // For export macro
55 #include "vtkDataObject.h"
56 
57 class vtkAbstractArray;
59 class vtkVariant;
60 class vtkVariantArray;
61 
62 class VTKCOMMONDATAMODEL_EXPORT vtkTable : public vtkDataObject
63 {
64 public:
65  static vtkTable* New();
66  static vtkTable* ExtendedNew();
67  vtkTypeMacro(vtkTable, vtkDataObject);
68  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
76  void Dump(unsigned int colWidth = 16, int rowLimit = -1);
77 
81  int GetDataObjectType() 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 
113  void SetNumberOfRows(const vtkIdType);
114 
119  vtkVariantArray* GetRow(vtkIdType row);
120 
124  void GetRow(vtkIdType row, vtkVariantArray* values);
125 
129  void SetRow(vtkIdType row, vtkVariantArray* values);
130 
134  vtkIdType InsertNextBlankRow(double default_num_val = 0.0);
135 
140  vtkIdType InsertNextRow(vtkVariantArray* values);
141 
145  void RemoveRow(vtkIdType row);
146 
147  //
148  // Column functions
149  //
150 
154  vtkIdType GetNumberOfColumns();
155 
156  // Get the name of a column of the table.
157  const char* GetColumnName(vtkIdType col);
158 
162  vtkAbstractArray* GetColumnByName(const char* name);
163 
167  vtkAbstractArray* GetColumn(vtkIdType col);
168 
172  void AddColumn(vtkAbstractArray* arr);
173 
177  void RemoveColumnByName(const char* name);
178 
182  void RemoveColumn(vtkIdType col);
183 
184  //
185  // Table single entry functions
186  //
187 
194  vtkVariant GetValue(vtkIdType row, vtkIdType col);
195 
199  vtkVariant GetValueByName(vtkIdType row, const char* col);
200 
204  void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
205 
209  void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
210 
214  void Initialize() override;
215 
217 
221  static vtkTable* GetData(vtkInformationVector* v, int i = 0);
223 
225 
228  void ShallowCopy(vtkDataObject* src) override;
229  void DeepCopy(vtkDataObject* src) override;
231 
239 
243  vtkIdType GetNumberOfElements(int type) override;
244 
245 protected:
246  vtkTable();
247  ~vtkTable() override;
248 
253 
258 
259 private:
260  vtkTable(const vtkTable&) = delete;
261  void operator=(const vtkTable&) = delete;
262 };
263 
264 #endif
vtkDataObject::Initialize
virtual void Initialize()
Restore data object to initial state,.
vtkDataObject::GetAttributesAsFieldData
virtual vtkFieldData * GetAttributesAsFieldData(int type)
Returns the attributes of the data object as a vtkFieldData.
vtkX3D::value
Definition: vtkX3D.h:226
vtkX3D::type
Definition: vtkX3D.h:522
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkDataObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataSetAttributes
represent and manipulate attribute data in a dataset
Definition: vtkDataSetAttributes.h:60
vtkX3D::data
Definition: vtkX3D.h:321
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
VTK_TABLE
#define VTK_TABLE
Definition: vtkType.h:96
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:49
vtkDataObject::DeepCopy
virtual void DeepCopy(vtkDataObject *src)
vtkTable::RowArray
vtkVariantArray * RowArray
Holds row information returned by GetRow().
Definition: vtkTable.h:257
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:53
vtkDataObject::GetNumberOfElements
virtual vtkIdType GetNumberOfElements(int type)
Get the number of elements for a specific attribute type (POINT, CELL, etc.).
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:65
vtkTable::GetDataObjectType
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTable.h:81
vtkX3D::name
Definition: vtkX3D.h:225
vtkDataObject::GetActualMemorySize
virtual unsigned long GetActualMemorySize()
Return the actual size of the data in kibibytes (1024 bytes).
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:75
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkTable::RowData
vtkDataSetAttributes * RowData
Holds the column data of the table.
Definition: vtkTable.h:252
vtkX3D::info
Definition: vtkX3D.h:382
vtkDataObject.h
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkDataObject::ShallowCopy
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.
vtkDataObject::GetData
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkDataObject::New
static vtkDataObject * New()