| 1 | //===----------------------------------------------------------------------===// |
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/optimizer/matcher/logical_operator_matcher.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/enums/logical_operator_type.hpp" |
| 12 | |
| 13 | namespace duckdb { |
| 14 | |
| 15 | //! The LogicalOperatorMatcher class contains a set of matchers that can be used to match LogicalOperators |
| 16 | class LogicalOperatorMatcher { |
| 17 | public: |
| 18 | virtual ~LogicalOperatorMatcher() { |
| 19 | } |
| 20 | |
| 21 | virtual bool Match(LogicalOperatorType type) = 0; |
| 22 | }; |
| 23 | |
| 24 | //! The SpecificLogicalTypeMatcher class matches only a single specified LogicalOperatorType |
| 25 | class SpecificLogicalTypeMatcher : public LogicalOperatorMatcher { |
| 26 | public: |
| 27 | SpecificLogicalTypeMatcher(LogicalOperatorType type) : type(type) { |
| 28 | } |
| 29 | |
| 30 | bool Match(LogicalOperatorType type) override { |
| 31 | return type == this->type; |
| 32 | } |
| 33 | |
| 34 | private: |
| 35 | LogicalOperatorType type; |
| 36 | }; |
| 37 | |
| 38 | } // namespace duckdb |
| 39 | |