Coverage Report

Created: 2025-09-03 03:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-source/src/statefunctions/router.h
Line
Count
Source
1
#pragma once
2
#include <map>
3
4
#include "types/statefunction.h"
5
6
namespace mahjong {
7
class Router {
8
 public:
9
3.03k
  static Router& Instance() {
10
3.03k
    static Router router;
11
3.03k
    return router;
12
3.03k
  }
13
14
  StateFunctionFunc Route(const StateFunctionType& type);
15
  bool RegisterRoute(StateFunctionFunc func, const StateFunctionType& type);
16
17
 private:
18
  std::map<StateFunctionType, StateFunctionFunc> routes_;
19
};
20
21
#define REGISTER_ROUTE(func, type)                                     \
22
  namespace {                                                          \
23
  bool __registered = Router::Instance().RegisterRoute(&(func), type); \
24
  }
25
26
}  // namespace mahjong