/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-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 | 68 | StateFunctionFunc Router::Route(const StateFunctionType& type) { |
9 | 68 | return routes_[type]; |
10 | 68 | } |
11 | | |
12 | | bool Router::RegisterRoute(StateFunctionFunc func, |
13 | 2.96k | const StateFunctionType& type) { |
14 | 2.96k | if (routes_.contains(type)) { |
15 | 0 | return false; |
16 | 0 | } |
17 | 2.96k | routes_[type] = std::move(func); |
18 | 2.96k | return true; |
19 | 2.96k | } |
20 | | } // namespace mahjong |