VTK  9.0.2
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  vtkTypeMacro(vtkTable, vtkDataObject);
67  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
75  void Dump(unsigned int colWidth = 16, int rowLimit = -1);
76 
80  int GetDataObjectType() override { return VTK_TABLE; }
81 
89  unsigned long GetActualMemorySize() override;
90 
92 
95  vtkGetObjectMacro(RowData, vtkDataSetAttributes);
98 
99  //
100  // Row functions
101  //
102 
107 
113 
119 
123  void GetRow(vtkIdType row, vtkVariantArray* values);
124 
128  void SetRow(vtkIdType row, vtkVariantArray* values);
129 
133  vtkIdType InsertNextBlankRow(double default_num_val = 0.0);
134 
140 
144  void RemoveRow(vtkIdType row);
145 
146  //
147  // Column functions
148  //
149 
154 
155  // Get the name of a column of the table.
156  const char* GetColumnName(vtkIdType col);
157 
162 
167 
172 
176  void RemoveColumnByName(const char* name);
177 
182 
183  //
184  // Table single entry functions
185  //
186 
194 
198  vtkVariant GetValueByName(vtkIdType row, const char* col);
199 
204 
208  void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
209 
213  void Initialize() override;
214 
216 
220  static vtkTable* GetData(vtkInformationVector* v, int i = 0);
222 
224 
227  void ShallowCopy(vtkDataObject* src) override;
228  void DeepCopy(vtkDataObject* src) override;
230 
238 
243 
244 protected:
246  ~vtkTable() override;
247 
252 
257 
258 private:
259  vtkTable(const vtkTable&) = delete;
260  void operator=(const vtkTable&) = delete;
261 };
262 
263 #endif
Abstract superclass for all arrays.
general representation of visualization data
Definition: vtkDataObject.h:60
represent and manipulate attribute data in a dataset
represent and manipulate fields of data
Definition: vtkFieldData.h:54
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:63
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
vtkVariantArray * GetRow(vtkIdType row)
Get a row of the table as a vtkVariantArray which has one entry for each column.
static vtkTable * New()
static vtkTable * GetData(vtkInformationVector *v, int i=0)
vtkDataSetAttributes * RowData
Holds the column data of the table.
Definition: vtkTable.h:251
virtual void SetRowData(vtkDataSetAttributes *data)
void AddColumn(vtkAbstractArray *arr)
Add a column to the table.
void SetNumberOfRows(const vtkIdType)
Set the number of rows in the table.
vtkIdType InsertNextRow(vtkVariantArray *arr)
Insert a row specified by a vtkVariantArray.
vtkIdType GetNumberOfElements(int type) override
Get the number of elements for a specific attribute type (ROW, etc.).
~vtkTable() override
void RemoveRow(vtkIdType row)
Delete a row from the table.
vtkAbstractArray * GetColumnByName(const char *name)
Get a column of the table by its name.
void DeepCopy(vtkDataObject *src) override
vtkVariant GetValueByName(vtkIdType row, const char *col)
Retrieve a value in the table by row index and column name as a variant.
vtkAbstractArray * GetColumn(vtkIdType col)
Get a column of the table by its column index.
vtkIdType GetNumberOfRows()
Get the number of rows in the table.
void Dump(unsigned int colWidth=16, int rowLimit=-1)
Dump table contents.
vtkIdType GetNumberOfColumns()
Get the number of columns in the table.
void SetRow(vtkIdType row, vtkVariantArray *values)
Set a row of the table with a vtkVariantArray which has one entry for each column.
void ShallowCopy(vtkDataObject *src) override
Shallow/deep copy the data from src into this object.
vtkVariant GetValue(vtkIdType row, vtkIdType col)
Retrieve a value in the table by row and column index as a variant.
vtkFieldData * GetAttributesAsFieldData(int type) override
Returns the attributes of the data object as a vtkFieldData.
void GetRow(vtkIdType row, vtkVariantArray *values)
Get a row of the table as a vtkVariantArray which has one entry for each column.
void RemoveColumnByName(const char *name)
Remove a column from the table by its name.
vtkVariantArray * RowArray
Holds row information returned by GetRow().
Definition: vtkTable.h:256
const char * GetColumnName(vtkIdType col)
void SetValue(vtkIdType row, vtkIdType col, vtkVariant value)
Set a value in the table by row and column index as a variant.
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTable.h:80
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize() override
Initialize to an empty table.
static vtkTable * GetData(vtkInformation *info)
Retrieve the table from vtkInformation.
vtkIdType InsertNextBlankRow(double default_num_val=0.0)
Insert a blank row at the end of the table.
void SetValueByName(vtkIdType row, const char *col, vtkVariant value)
Set a value in the table by row index and column name as a variant.
void RemoveColumn(vtkIdType col)
Remove a column from the table by its column index.
An array holding vtkVariants.
A atomic type representing the union of many types.
Definition: vtkVariant.h:66
@ info
Definition: vtkX3D.h:382
@ value
Definition: vtkX3D.h:226
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
@ data
Definition: vtkX3D.h:321
int vtkIdType
Definition: vtkType.h:338
#define VTK_TABLE
Definition: vtkType.h:104