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) VTK_OVERRIDE;
74 
81  void Dump( unsigned int colWidth = 16, int rowLimit = -1 );
82 
86  int GetDataObjectType() VTK_OVERRIDE {return VTK_TABLE;}
87 
95  unsigned long GetActualMemorySize() VTK_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() VTK_OVERRIDE;
220 
222 
225  static vtkTable* GetData(vtkInformation* info);
226  static vtkTable* GetData(vtkInformationVector* v, int i=0);
228 
230 
233  void ShallowCopy(vtkDataObject* src) VTK_OVERRIDE;
234  void DeepCopy(vtkDataObject* src) VTK_OVERRIDE;
236 
243  vtkFieldData* GetAttributesAsFieldData(int type) VTK_OVERRIDE;
244 
248  vtkIdType GetNumberOfElements(int type) VTK_OVERRIDE;
249 
250 protected:
251  vtkTable();
252  ~vtkTable() VTK_OVERRIDE;
253 
257  vtkDataSetAttributes* RowData;
258 
262  vtkVariantArray* RowArray;
263 
264 private:
265  vtkTable(const vtkTable&) VTK_DELETE_FUNCTION;
266  void operator=(const vtkTable&) VTK_DELETE_FUNCTION;
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 * New()
An array holding vtkVariants.
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
#define VTK_TABLE
Definition: vtkType.h:106
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
int vtkIdType
Definition: vtkType.h:287
A atomic type representing the union of many types.
Definition: vtkVariant.h:75
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTable.h:86
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).
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
represent and manipulate fields of data
Definition: vtkFieldData.h:56