1#pragma once
2
3#include <AggregateFunctions/IAggregateFunctionCombinator.h>
4
5
6#include <string>
7#include <unordered_map>
8
9
10namespace DB
11{
12
13/** Create aggregate function combinator by matching suffix in aggregate function name.
14 */
15class AggregateFunctionCombinatorFactory final: private boost::noncopyable
16{
17private:
18 using Dict = std::unordered_map<std::string, AggregateFunctionCombinatorPtr>;
19 Dict dict;
20
21public:
22
23 static AggregateFunctionCombinatorFactory & instance();
24
25 /// Not thread safe. You must register before using tryGet.
26 void registerCombinator(const AggregateFunctionCombinatorPtr & value);
27
28 /// Example: if the name is 'avgIf', it will return combinator -If.
29 AggregateFunctionCombinatorPtr tryFindSuffix(const std::string & name) const;
30
31 const Dict & getAllAggregateFunctionCombinators() const
32 {
33 return dict;
34 }
35};
36
37}
38