VTK  9.2.6
vtkJoinTables.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkJoinTables.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 =========================================================================*/
31 #ifndef vtkJoinTables_h
32 #define vtkJoinTables_h
33 
34 #include "vtkDataArray.h" // For numeric key columns
35 #include "vtkFiltersGeneralModule.h" // For export macro
36 #include "vtkStringArray.h" // For string key columns
37 #include "vtkTable.h" // For table inputs
38 #include "vtkTableAlgorithm.h"
39 
40 #include <map> // For left and right key maps
41 #include <string> // For LeftKey and RightKey
42 
43 class VTKFILTERSGENERAL_EXPORT vtkJoinTables : public vtkTableAlgorithm
44 {
45 public:
46  static vtkJoinTables* New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
50  enum JoinMode
51  {
52  INTERSECTION = 0,
53  UNION = 1,
54  LEFT = 2,
55  RIGHT = 3
56  };
57 
59 
67  vtkSetClampMacro(Mode, int, 0, 3);
68  vtkGetMacro(Mode, int);
70 
72 
76  vtkSetMacro(ReplacementValue, double);
77  vtkGetMacro(ReplacementValue, double);
79 
81 
87 
89 
95 
101 
107 
108 protected:
110  ~vtkJoinTables() override = default;
111 
112  template <typename T>
113  struct Maps
114  {
115  std::map<T, int> left;
116  std::map<T, int> right;
117  };
118 
119  template <typename ColType, typename KeyColType, typename KeyValues>
120  void MergeColumn(ColType*, ColType*, KeyColType*, const char*, std::map<KeyValues, int>);
121 
122  template <typename KeyColType, typename KeyValues>
123  void JoinAlgorithm(vtkTable*, vtkTable*, vtkTable*, KeyColType*, KeyColType*, Maps<KeyValues>*);
124 
127 
128  int Mode = JoinMode::INTERSECTION;
131  double ReplacementValue = 0;
132 
133 private:
134  vtkJoinTables(const vtkJoinTables&) = delete;
135  void operator=(const vtkJoinTables&) = delete;
136 };
137 
138 #include "vtkJoinTables.txx" // for template implementations
139 
140 #endif
Proxy object to connect input/output ports.
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
SQL-style Join operation on two tables.
Definition: vtkJoinTables.h:44
vtkGetCharFromStdStringMacro(LeftKey)
Specifies which column of the left table to use for the join operation.
vtkSetStdStringFromCharMacro(LeftKey)
Specifies which column of the left table to use for the join operation.
void SetSourceData(vtkTable *source)
Specify input data on port 1 for the right table.
static vtkJoinTables * New()
void SetSourceConnection(vtkAlgorithmOutput *source)
Set a pipeline connection on port 1 for the right table.
vtkGetCharFromStdStringMacro(RightKey)
Specifies which column of the right table to use for the join operation.
vtkSetStdStringFromCharMacro(RightKey)
Specifies which column of the right table to use for the join operation.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void JoinAlgorithm(vtkTable *, vtkTable *, vtkTable *, KeyColType *, KeyColType *, Maps< KeyValues > *)
std::string LeftKey
~vtkJoinTables() override=default
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void MergeColumn(ColType *, ColType *, KeyColType *, const char *, std::map< KeyValues, int >)
std::string RightKey
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:183
@ string
Definition: vtkX3D.h:496
std::map< T, int > left
std::map< T, int > right
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)