| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/function/function_set.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/function/aggregate_function.hpp" |
| 12 | #include "duckdb/function/scalar_function.hpp" |
| 13 | |
| 14 | namespace duckdb { |
| 15 | |
| 16 | template <class T> class FunctionSet { |
| 17 | public: |
| 18 | FunctionSet(string name) : name(name) { |
| 19 | } |
| 20 | |
| 21 | //! The name of the function set |
| 22 | string name; |
| 23 | //! The set of functions |
| 24 | vector<T> functions; |
| 25 | |
| 26 | public: |
| 27 | void AddFunction(T function) { |
| 28 | function.name = name; |
| 29 | functions.push_back(function); |
| 30 | } |
| 31 | }; |
| 32 | |
| 33 | class ScalarFunctionSet : public FunctionSet<ScalarFunction> { |
| 34 | public: |
| 35 | ScalarFunctionSet(string name) : FunctionSet(move(name)) { |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | class AggregateFunctionSet : public FunctionSet<AggregateFunction> { |
| 40 | public: |
| 41 | AggregateFunctionSet(string name) : FunctionSet(move(name)) { |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | } // namespace duckdb |
| 46 |