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-------------------------------------------------------------------------*/
55
56#ifndef vtkTable_h
57#define vtkTable_h
58
59#include "vtkCommonDataModelModule.h" // For export macro
60#include "vtkDataObject.h"
61
64class vtkVariant;
65class vtkVariantArray;
66
67class VTKCOMMONDATAMODEL_EXPORT vtkTable : public vtkDataObject
68{
69public:
70 static vtkTable* New();
72 vtkTypeMacro(vtkTable, vtkDataObject);
73 void PrintSelf(ostream& os, vtkIndent indent) override;
74
81 void Dump(unsigned int colWidth = 16, int rowLimit = -1);
82
86 int GetDataObjectType() override { return VTK_TABLE; }
87
95 unsigned long GetActualMemorySize() override;
96
98
101 vtkGetObjectMacro(RowData, vtkDataSetAttributes);
102 virtual void SetRowData(vtkDataSetAttributes* data);
104
105 //
106 // Row functions
107 //
108
113
120
125
131
135 void GetRow(vtkIdType row, vtkVariantArray* values);
136
140 void SetRow(vtkIdType row, vtkVariantArray* values);
141
146
151
155 vtkIdType InsertNextBlankRow(double default_num_val = 0.0);
156
162
167
172
178
179 //
180 // Column functions
181 //
182
187
188 // Get the name of a column of the table.
189 const char* GetColumnName(vtkIdType col);
190
195
200 vtkIdType GetColumnIndex(const char* name);
201
206
211
216
220 void RemoveColumnByName(const char* name);
221
226
231
232 //
233 // Table single entry functions
234 //
235
243
247 vtkVariant GetValueByName(vtkIdType row, const char* col);
248
252 void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
253
257 void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
258
262 void Initialize() override;
263
265
269 static vtkTable* GetData(vtkInformationVector* v, int i = 0);
271
273
276 void ShallowCopy(vtkDataObject* src) override;
277 void DeepCopy(vtkDataObject* src) override;
279
287
291 vtkIdType GetNumberOfElements(int type) override;
292
293protected:
295 ~vtkTable() override;
296
301
306
312 void MoveRowData(vtkIdType first, vtkIdType last, vtkIdType delta);
313
314private:
315 vtkTable(const vtkTable&) = delete;
316 void operator=(const vtkTable&) = delete;
317};
318
319#endif
Abstract superclass for all arrays.
represent and manipulate attribute data in a dataset
represent and manipulate fields of data
a simple class to control print indentation
Definition vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
vtkDataSetAttributes * RowData
Holds the column data of the table.
Definition vtkTable.h:300
virtual void SetRowData(vtkDataSetAttributes *data)
Get/Set the main data (columns) of the table.
void AddColumn(vtkAbstractArray *arr)
Add a column to the table.
void SetNumberOfRows(const vtkIdType)
Set the number of rows in the table.
vtkIdType GetNumberOfElements(int type) override
Get the number of elements for a specific attribute type (ROW, etc.).
~vtkTable() override
void InsertColumn(vtkAbstractArray *arr, vtkIdType index)
Insert a column into the table at given column index.
void MoveRowData(vtkIdType first, vtkIdType last, vtkIdType delta)
Move the content of the rows, starting first row and including last row.
vtkFieldData * GetAttributesAsFieldData(int type) override
Returns the attributes of the data object as a vtkFieldData.
vtkIdType GetColumnIndex(const char *name)
Get the column index for a name.
void RemoveRow(vtkIdType row)
Delete a single row from the table.
void InsertRow(vtkIdType row)
Insert a single row at the index.
void DeepCopy(vtkDataObject *src) override
Shallow/deep copy the data from src into this object.
vtkVariant GetValueByName(vtkIdType row, const char *col)
Retrieve a value in the table by row index and column name as a variant.
static vtkTable * New()
vtkAbstractArray * GetColumnByName(const char *name)
Get a column of the table by its name.
vtkIdType InsertNextRow(vtkVariantArray *values)
Insert a row at the end of the tablespecified by a vtkVariantArray.
vtkIdType GetNumberOfRows()
Get the number of rows in the table.
static vtkTable * GetData(vtkInformation *info)
Retrieve the table from vtkInformation.
void SqueezeRows()
Release previously allocated and now unused memory after performing resizing operations.
void Dump(unsigned int colWidth=16, int rowLimit=-1)
Dump table contents.
vtkIdType GetNumberOfColumns()
Get the number of columns in the table.
vtkAbstractArray * GetColumn(vtkIdType col)
Get a column of the table by its column index.
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.
static vtkTable * GetData(vtkInformationVector *v, int i=0)
Retrieve the table from vtkInformation.
void RemoveRows(vtkIdType row, vtkIdType n)
Delete n rows from the table, starting at row.
static vtkTable * ExtendedNew()
void GetRow(vtkIdType row, vtkVariantArray *values)
Get a row of the table as a vtkVariantArray which has one entry for each column.
void RemoveAllColumns()
Remove all columns from the table.
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:305
void SetValue(vtkIdType row, vtkIdType col, vtkVariant value)
Set a value in the table by row and column index as a variant.
void RemoveAllRows()
Delete all rows from the table.
void InsertRows(vtkIdType row, vtkIdType n)
Insert n rows before row.
int GetDataObjectType() override
Return what type of dataset this is.
Definition vtkTable.h:86
vtkVariantArray * GetRow(vtkIdType row)
Get a row of the table as a vtkVariantArray which has one entry for each column.
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.
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.
const char * GetColumnName(vtkIdType col)
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:64
int vtkIdType
Definition vtkType.h:332
#define VTK_TABLE
Definition vtkType.h:96