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 -------------------------------------------------------------------------*/
56 #ifndef __vtkTable_h
57 #define __vtkTable_h
58 
59 #include "vtkDataObject.h"
60 
61 class vtkAbstractArray;
63 class vtkVariant;
64 class vtkVariantArray;
65 
67 {
68 public:
69  static vtkTable* New();
70  vtkTypeMacro(vtkTable, vtkDataObject);
71  void PrintSelf(ostream &os, vtkIndent indent);
72 
74  void Dump( unsigned int colWidth = 16 );
75 
77  int GetDataObjectType() {return VTK_TABLE;}
78 
84  virtual unsigned long GetActualMemorySize();
85 
87 
88  vtkGetObjectMacro(RowData, vtkDataSetAttributes);
89  virtual void SetRowData(vtkDataSetAttributes* data);
91 
92  //
93  // Row functions
94  //
95 
97  vtkIdType GetNumberOfRows();
98 
102  void SetNumberOfRows(const vtkIdType );
103 
106  vtkVariantArray* GetRow(vtkIdType row);
107 
110  void GetRow(vtkIdType row, vtkVariantArray *values);
111 
114  void SetRow(vtkIdType row, vtkVariantArray *values);
115 
117  vtkIdType InsertNextBlankRow(double default_num_val=0.0);
118 
121  vtkIdType InsertNextRow(vtkVariantArray* arr);
122 
125  void RemoveRow(vtkIdType row);
126 
127  //
128  // Column functions
129  //
130 
132  vtkIdType GetNumberOfColumns();
133 
134  // Get the name of a column of the table.
135  const char* GetColumnName(vtkIdType col);
136 
138  vtkAbstractArray* GetColumnByName(const char* name);
139 
141  vtkAbstractArray* GetColumn(vtkIdType col);
142 
144  void AddColumn(vtkAbstractArray* arr);
145 
147  void RemoveColumnByName(const char* name);
148 
150  void RemoveColumn(vtkIdType col);
151 
152  //
153  // Table single entry functions
154  //
155 
160  vtkVariant GetValue(vtkIdType row, vtkIdType col);
161 
164  vtkVariant GetValueByName(vtkIdType row, const char* col);
165 
167  void SetValue(vtkIdType row, vtkIdType col, vtkVariant value);
168 
170  void SetValueByName(vtkIdType row, const char* col, vtkVariant value);
171 
173  virtual void Initialize();
174 
176 
178  static vtkTable* GetData(vtkInformationVector* v, int i=0);
180 
182 
183  virtual void ShallowCopy(vtkDataObject* src);
184  virtual void DeepCopy(vtkDataObject* src);
186 
192 
194  virtual vtkIdType GetNumberOfElements(int type);
195 
196 protected:
197  vtkTable();
198  ~vtkTable();
199 
202 
205 
206 private:
207  vtkTable(const vtkTable&); // Not implemented
208  void operator=(const vtkTable&); // Not implemented
209 };
210 
211 #endif
212