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=========================================================================*/
28#ifndef vtkJoinTables_h
29#define vtkJoinTables_h
30
31#include "vtkDataArray.h" // For numeric key columns
32#include "vtkFiltersGeneralModule.h" // For export macro
33#include "vtkStringArray.h" // For string key columns
34#include "vtkTable.h" // For table inputs
35#include "vtkTableAlgorithm.h"
36
37#include <map> // For left and right key maps
38#include <string> // For LeftKey and RightKey
39
40class VTKFILTERSGENERAL_EXPORT vtkJoinTables : public vtkTableAlgorithm
41{
42public:
43 static vtkJoinTables* New();
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48 {
49 INTERSECTION = 0,
50 UNION = 1,
51 LEFT = 2,
52 RIGHT = 3
53 };
54
56
64 vtkSetClampMacro(Mode, int, 0, 3);
65 vtkGetMacro(Mode, int);
67
69
73 vtkSetMacro(ReplacementValue, double);
74 vtkGetMacro(ReplacementValue, double);
76
78
84
86
92
98
104
105protected:
107 ~vtkJoinTables() override = default;
108
109 template <typename T>
110 struct Maps
111 {
112 std::map<T, int> left;
113 std::map<T, int> right;
114 };
115
116 template <typename ColType, typename KeyColType, typename KeyValues>
117 void MergeColumn(ColType*, ColType*, KeyColType*, const char*, std::map<KeyValues, int>);
118
119 template <typename KeyColType, typename KeyValues>
120 void JoinAlgorithm(vtkTable*, vtkTable*, vtkTable*, KeyColType*, KeyColType*, Maps<KeyValues>*);
121
124
125 int Mode = JoinMode::INTERSECTION;
126 std::string LeftKey;
127 std::string RightKey;
128 double ReplacementValue = 0;
129
130private:
131 vtkJoinTables(const vtkJoinTables&) = delete;
132 void operator=(const vtkJoinTables&) = delete;
133};
134
135#include "vtkJoinTables.txx" // for template implementations
136
137#endif
Proxy object to connect input/output ports.
a simple class to control print indentation
Definition vtkIndent.h:34
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:68
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 *)