VTK
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 -------------------------------------------------------------------------*/
57 #ifndef vtkTable_h
58 #define vtkTable_h
59 
60 #include "vtkCommonDataModelModule.h" // For export macro
61 #include "vtkDataObject.h"
62 
63 class vtkAbstractArray;
65 class vtkVariant;
66 class vtkVariantArray;
67 
68 class VTKCOMMONDATAMODEL_EXPORT vtkTable : public vtkDataObject
69 {
70 public:
71  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 
112  vtkIdType GetNumberOfRows();
113 
118  void SetNumberOfRows(const vtkIdType );
119 
124  vtkVariantArray* GetRow(vtkIdType row);
125 
129  void GetRow(vtkIdType row, vtkVariantArray *values);
130 
134  void SetRow(vtkIdType row, vtkVariantArray *values);
135 
139  vtkIdType InsertNextBlankRow(double default_num_val=0.0);
140 
145  vtkIdType InsertNextRow(vtkVariantArray* arr);
146 
150  void RemoveRow(vtkIdType row);
151 
152  //
153  // Column functions
154  //
155 
159  vtkIdType GetNumberOfColumns();
160 
161  // Get the name of a column of the table.
162  const char* GetColumnName(vtkIdType col);
163 
167  vtkAbstractArray* GetColumnByName(const char* name);
168 
172  vtkAbstractArray* GetColumn(vtkIdType col);
173 
177  void AddColumn(vtkAbstractArray* arr);
178 
182  void RemoveColumnByName(const char* name);
183 
187  void RemoveColumn(vtkIdType col);
188 
189  //
190  // Table single entry functions
191  //
192 
199  vtkVariant GetValue(vtkIdType row, vtkIdType col);
200 
204  vtkVariant GetValueByName(vtkIdType row, const char* col);
205 
209  void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
210 
214  void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
215 
219  void Initialize() override;
220 
222 
226  static vtkTable* GetData(vtkInformationVector* v, int i=0);
228 
230 
233  void ShallowCopy(vtkDataObject* src) override;
234  void DeepCopy(vtkDataObject* src) override;
236 
244 
248  vtkIdType GetNumberOfElements(int type) override;
249 
250 protected:
251  vtkTable();
252  ~vtkTable() override;
253 
258 
263 
264 private:
265  vtkTable(const vtkTable&) = delete;
266  void operator=(const vtkTable&) = delete;
267 };
268 
269 #endif
270 
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:110
virtual void Initialize()
Restore data object to initial state,.
int vtkIdType
Definition: vtkType.h:347
A atomic type representing the union of many types.
Definition: vtkVariant.h:71
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTable.h:86
vtkVariantArray * RowArray
Holds row information returned by GetRow().
Definition: vtkTable.h:262
a simple class to control print indentation
Definition: vtkIndent.h:39
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:68
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:64
vtkDataSetAttributes * RowData
Holds the column data of the table.
Definition: vtkTable.h:257
virtual void DeepCopy(vtkDataObject *src)
Shallow and Deep copy.
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.
represent and manipulate fields of data
Definition: vtkFieldData.h:56