-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathoperator_visitor.h
More file actions
93 lines (89 loc) · 4.6 KB
/
Copy pathoperator_visitor.h
File metadata and controls
93 lines (89 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma once
#include "silo/common/aa_symbols.h"
#include "silo/common/nucleotide_symbols.h"
#include "silo/common/panic.h"
#include "silo/query_engine/operators/aggregate_node.h"
#include "silo/query_engine/operators/bitmap_aggregation_node.h"
#include "silo/query_engine/operators/count_filter_node.h"
#include "silo/query_engine/operators/fetch_node.h"
#include "silo/query_engine/operators/filter_node.h"
#include "silo/query_engine/operators/insertions_node.h"
#include "silo/query_engine/operators/join_node.h"
#include "silo/query_engine/operators/map_node.h"
#include "silo/query_engine/operators/most_recent_common_ancestor_node.h"
#include "silo/query_engine/operators/mutations_node.h"
#include "silo/query_engine/operators/order_by_node.h"
#include "silo/query_engine/operators/phylo_subtree_node.h"
#include "silo/query_engine/operators/project_node.h"
#include "silo/query_engine/operators/schema_node.h"
#include "silo/query_engine/operators/table_scan_node.h"
#include "silo/query_engine/operators/union_all_node.h"
#include "silo/query_engine/operators/unresolved_insertions_node.h"
#include "silo/query_engine/operators/unresolved_most_recent_common_ancestor_node.h"
#include "silo/query_engine/operators/unresolved_mutations_node.h"
#include "silo/query_engine/operators/unresolved_phylo_subtree_node.h"
namespace silo::query_engine::operators {
template <typename Func>
// NOLINTNEXTLINE(misc-no-recursion)
decltype(auto) visit(QueryNode& node, Func&& func) {
switch (node.kind()) {
case NodeKind::AGGREGATE:
return std::forward<Func>(func)(static_cast<AggregateNode&>(node));
case NodeKind::PROJECT:
return std::forward<Func>(func)(static_cast<ProjectNode&>(node));
case NodeKind::MAP:
return std::forward<Func>(func)(static_cast<MapNode&>(node));
case NodeKind::ORDER_BY:
return std::forward<Func>(func)(static_cast<OrderByNode&>(node));
case NodeKind::FETCH:
return std::forward<Func>(func)(static_cast<FetchNode&>(node));
case NodeKind::FILTER:
return std::forward<Func>(func)(static_cast<FilterNode&>(node));
case NodeKind::UNRESOLVED_MUTATIONS_NUCLEOTIDE:
return std::forward<Func>(func)(
static_cast<UnresolvedMutationsNode<silo::Nucleotide>&>(node)
);
case NodeKind::UNRESOLVED_MUTATIONS_AMINO_ACID:
return std::forward<Func>(func)(static_cast<UnresolvedMutationsNode<silo::AminoAcid>&>(node
));
case NodeKind::UNRESOLVED_INSERTIONS_NUCLEOTIDE:
return std::forward<Func>(func)(
static_cast<UnresolvedInsertionsNode<silo::Nucleotide>&>(node)
);
case NodeKind::UNRESOLVED_INSERTIONS_AMINO_ACID:
return std::forward<Func>(func)(
static_cast<UnresolvedInsertionsNode<silo::AminoAcid>&>(node)
);
case NodeKind::UNRESOLVED_MOST_RECENT_COMMON_ANCESTOR:
return std::forward<Func>(func)(static_cast<UnresolvedMostRecentCommonAncestorNode&>(node)
);
case NodeKind::UNRESOLVED_PHYLO_SUBTREE:
return std::forward<Func>(func)(static_cast<UnresolvedPhyloSubtreeNode&>(node));
case NodeKind::MUTATIONS_NUCLEOTIDE:
return std::forward<Func>(func)(static_cast<MutationsNode<silo::Nucleotide>&>(node));
case NodeKind::MUTATIONS_AMINO_ACID:
return std::forward<Func>(func)(static_cast<MutationsNode<silo::AminoAcid>&>(node));
case NodeKind::INSERTIONS_NUCLEOTIDE:
return std::forward<Func>(func)(static_cast<InsertionsNode<silo::Nucleotide>&>(node));
case NodeKind::INSERTIONS_AMINO_ACID:
return std::forward<Func>(func)(static_cast<InsertionsNode<silo::AminoAcid>&>(node));
case NodeKind::MOST_RECENT_COMMON_ANCESTOR:
return std::forward<Func>(func)(static_cast<MostRecentCommonAncestorNode&>(node));
case NodeKind::PHYLO_SUBTREE:
return std::forward<Func>(func)(static_cast<PhyloSubtreeNode&>(node));
case NodeKind::TABLE_SCAN:
return std::forward<Func>(func)(static_cast<TableScanNode&>(node));
case NodeKind::COUNT_FILTER:
return std::forward<Func>(func)(static_cast<CountFilterNode&>(node));
case NodeKind::UNION_ALL:
return std::forward<Func>(func)(static_cast<UnionAllNode&>(node));
case NodeKind::JOIN:
return std::forward<Func>(func)(static_cast<JoinNode&>(node));
case NodeKind::SCHEMA:
return std::forward<Func>(func)(static_cast<SchemaNode&>(node));
case NodeKind::BITMAP_AGGREGATION:
return std::forward<Func>(func)(static_cast<BitmapAggregationNode&>(node));
}
SILO_UNREACHABLE();
}
} // namespace silo::query_engine::operators