/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/statefunctions/router.cc
Line | Count | Source |
1 | | #include "statefunctions/router.h" |
2 | | |
3 | | #include <utility> |
4 | | |
5 | | #include "types/statefunction.h" |
6 | | |
7 | | namespace mahjong { |
8 | 63 | StateFunctionFunc Router::Route(const StateFunctionType& type) { |
9 | 63 | return routes_[type]; |
10 | 63 | } |
11 | | |
12 | | bool Router::RegisterRoute(StateFunctionFunc func, |
13 | 2.81k | const StateFunctionType& type) { |
14 | 2.81k | if (routes_.contains(type)) { |
15 | 0 | return false; |
16 | 0 | } |
17 | 2.81k | routes_[type] = std::move(func); |
18 | 2.81k | return true; |
19 | 2.81k | } |
20 | | } // namespace mahjong |