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 -------------------------------------------------------------------------*/
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);
96  virtual void SetRowData(vtkDataSetAttributes* data);
98 
99  //
100  // Row functions
101  //
102 
106  vtkIdType GetNumberOfRows();
107 
112  void SetNumberOfRows(const vtkIdType );
113 
118  vtkVariantArray* GetRow(vtkIdType row);
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 
139  vtkIdType InsertNextRow(vtkVariantArray* arr);
140 
144  void RemoveRow(vtkIdType row);
145 
146  //
147  // Column functions
148  //
149 
153  vtkIdType GetNumberOfColumns();
154 
155  // Get the name of a column of the table.
156  const char* GetColumnName(vtkIdType col);
157 
161  vtkAbstractArray* GetColumnByName(const char* name);
162 
166  vtkAbstractArray* GetColumn(vtkIdType col);
167 
171  void AddColumn(vtkAbstractArray* arr);
172 
176  void RemoveColumnByName(const char* name);
177 
181  void RemoveColumn(vtkIdType col);
182 
183  //
184  // Table single entry functions
185  //
186 
193  vtkVariant GetValue(vtkIdType row, vtkIdType col);
194 
198  vtkVariant GetValueByName(vtkIdType row, const char* col);
199 
203  void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
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 
242  vtkIdType GetNumberOfElements(int type) override;
243 
244 protected:
245  vtkTable();
246  ~vtkTable() override;
247 
252 
257 
258 private:
259  vtkTable(const vtkTable&) = delete;
260  void operator=(const vtkTable&) = delete;
261 };
262 
263 #endif
264 
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:220
vtkX3D::type
Definition: vtkX3D.h:516
vtkIdType
int vtkIdType
Definition: vtkType.h:347
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:53
vtkX3D::data
Definition: vtkX3D.h:315
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:110
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:43
vtkDataObject::DeepCopy
virtual void DeepCopy(vtkDataObject *src)
vtkTable::RowArray
vtkVariantArray * RowArray
Holds row information returned by GetRow().
Definition: vtkTable.h:256
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:80
vtkX3D::name
Definition: vtkX3D.h:219
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:80
vtkTable::RowData
vtkDataSetAttributes * RowData
Holds the column data of the table.
Definition: vtkTable.h:251
vtkX3D::info
Definition: vtkX3D.h:376
vtkDataObject.h
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
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()