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 
84  vtkSetStdStringFromCharMacro(LeftKey);
85  vtkGetCharFromStdStringMacro(LeftKey);
87 
89 
92  vtkSetStdStringFromCharMacro(RightKey);
93  vtkGetCharFromStdStringMacro(RightKey);
95 
100  void SetSourceConnection(vtkAlgorithmOutput* source);
101 
106  void SetSourceData(vtkTable* source);
107 
108 protected:
109  vtkJoinTables();
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 
126  int FillInputPortInformation(int, vtkInformation*) override;
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
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:43
std::string LeftKey
Proxy object to connect input/output ports.
a simple class to control print indentation
Definition: vtkIndent.h:39
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:73
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