VTK  9.3.20240907
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
31VTK_ABI_NAMESPACE_BEGIN
32class VTKFILTERSGENERAL_EXPORT vtkJoinTables : public vtkTableAlgorithm
33{
34public:
35 static vtkJoinTables* New();
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
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
76
78
84
90
96
97protected:
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
116
117 int Mode = JoinMode::INTERSECTION;
118 std::string LeftKey;
119 std::string RightKey;
120 double ReplacementValue = 0;
121
122private:
123 vtkJoinTables(const vtkJoinTables&) = delete;
124 void operator=(const vtkJoinTables&) = delete;
125};
126
127VTK_ABI_NAMESPACE_END
128#include "vtkJoinTables.txx" // for template implementations
129
130#endif
Proxy object to connect input/output ports.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
SQL-style Join operation on two tables.
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.
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
static vtkJoinTables * New()
~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:169
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 *)