Coverage Report

Created: 2026-11-14 03:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/statefunctions/router.h
Line
Count
Source
1
#pragma once
2
#include <unordered_map>
3
4
#include "types/statefunction.h"
5
6
namespace mahjong {
7
class Router {
8
 public:
9
2.87k
  static Router& Instance() {
10
2.87k
    static Router router;
11
2.87k
    return router;
12
2.87k
  }
13
14
  StateFunctionFunc Route(const StateFunctionType& type);
15
  bool RegisterRoute(StateFunctionFunc func, const StateFunctionType& type);
16
17
 private:
18
  std::unordered_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