VTK  9.3.1
vtkJoinTables.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
19 #ifndef vtkJoinTables_h
20 #define vtkJoinTables_h
21 
22 #include "vtkDataArray.h" // For numeric key columns
23 #include "vtkFiltersGeneralModule.h" // For export macro
24 #include "vtkStringArray.h" // For string key columns
25 #include "vtkTable.h" // For table inputs
26 #include "vtkTableAlgorithm.h"
27 
28 #include <map> // For left and right key maps
29 #include <string> // For LeftKey and RightKey
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class VTKFILTERSGENERAL_EXPORT vtkJoinTables : public vtkTableAlgorithm
33 {
34 public:
35  static vtkJoinTables* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
39  enum JoinMode
40  {
41  INTERSECTION = 0,
42  UNION = 1,
43  LEFT = 2,
44  RIGHT = 3
45  };
46 
48 
56  vtkSetClampMacro(Mode, int, 0, 3);
57  vtkGetMacro(Mode, int);
59 
61 
65  vtkSetMacro(ReplacementValue, double);
66  vtkGetMacro(ReplacementValue, double);
68 
70 
73  vtkSetStdStringFromCharMacro(LeftKey);
74  vtkGetCharFromStdStringMacro(LeftKey);
76 
78 
81  vtkSetStdStringFromCharMacro(RightKey);
82  vtkGetCharFromStdStringMacro(RightKey);
84 
89  void SetSourceConnection(vtkAlgorithmOutput* source);
90 
95  void SetSourceData(vtkTable* source);
96 
97 protected:
98  vtkJoinTables();
99  ~vtkJoinTables() override = default;
100 
101  template <typename T>
102  struct Maps
103  {
104  std::map<T, int> left;
105  std::map<T, int> right;
106  };
107 
108  template <typename ColType, typename KeyColType, typename KeyValues>
109  void MergeColumn(ColType*, ColType*, KeyColType*, const char*, std::map<KeyValues, int>);
110 
111  template <typename KeyColType, typename KeyValues>
112  void JoinAlgorithm(vtkTable*, vtkTable*, vtkTable*, KeyColType*, KeyColType*, Maps<KeyValues>*);
113 
115  int FillInputPortInformation(int, vtkInformation*) override;
116 
117  int Mode = JoinMode::INTERSECTION;
120  double ReplacementValue = 0;
121 
122 private:
123  vtkJoinTables(const vtkJoinTables&) = delete;
124  void operator=(const vtkJoinTables&) = delete;
125 };
126 
127 VTK_ABI_NAMESPACE_END
128 #include "vtkJoinTables.txx" // for template implementations
129 
130 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkTableAlgorithm * New()
Store vtkAlgorithm input/output information.
std::string RightKey
SQL-style Join operation on two tables.
Definition: vtkJoinTables.h:32
std::string LeftKey
Proxy object to connect input/output ports.
a simple class to control print indentation
Definition: vtkIndent.h:28
std::map< T, int > right
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:58
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Superclass for algorithms that produce only vtkTables as output.
Store zero or more vtkInformation instances.
std::map< T, int > left