1 | #pragma once |
---|---|
2 | #include <string> |
3 | |
4 | namespace DB |
5 | { |
6 | namespace ASOF |
7 | { |
8 | |
9 | enum class Inequality |
10 | { |
11 | None = 0, |
12 | Less, |
13 | Greater, |
14 | LessOrEquals, |
15 | GreaterOrEquals, |
16 | }; |
17 | |
18 | inline Inequality getInequality(const std::string & func_name) |
19 | { |
20 | Inequality inequality{Inequality::None}; |
21 | if (func_name == "less") |
22 | inequality = Inequality::Less; |
23 | else if (func_name == "greater") |
24 | inequality = Inequality::Greater; |
25 | else if (func_name == "lessOrEquals") |
26 | inequality = Inequality::LessOrEquals; |
27 | else if (func_name == "greaterOrEquals") |
28 | inequality = Inequality::GreaterOrEquals; |
29 | return inequality; |
30 | } |
31 | |
32 | inline Inequality reverseInequality(Inequality inequality) |
33 | { |
34 | if (inequality == Inequality::Less) |
35 | return Inequality::Greater; |
36 | else if (inequality == Inequality::Greater) |
37 | return Inequality::Less; |
38 | else if (inequality == Inequality::LessOrEquals) |
39 | return Inequality::GreaterOrEquals; |
40 | else if (inequality == Inequality::GreaterOrEquals) |
41 | return Inequality::LessOrEquals; |
42 | return Inequality::None; |
43 | } |
44 | |
45 | } |
46 | } |
47 |