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/controllers/controllermanager.h
Line
Count
Source
1
#pragma once
2
#include <functional>
3
#include <memory>
4
#include <string>
5
#include <unordered_map>
6
#include <vector>
7
8
#include "controllers/playercontroller.h"
9
10
namespace mahjong {
11
using newControllerInst = std::function<std::unique_ptr<PlayerController>()>;
12
13
class ControllerManager {
14
 public:
15
1.03k
  static ControllerManager& Instance() {
16
1.03k
    static ControllerManager controller_manager;
17
1.03k
    return controller_manager;
18
1.03k
  }
19
20
  std::unordered_map<std::string, newControllerInst>
21
0
  GetAvailableControllersMap() {
22
0
    return available_controllers_;
23
0
  }
24
  std::vector<std::string> GetAvailableControllers();
25
  std::unique_ptr<mahjong::PlayerController> NewController(
26
      const std::string& controller);
27
  bool RegisterController(newControllerInst newFunc, const std::string& Name);
28
29
 private:
30
  std::unordered_map<std::string, newControllerInst> available_controllers_;
31
};
32
33
#define REGISTER_PLAYER_CONTROLLER(controller)                          \
34
  namespace {                                                           \
35
  bool __registered = ControllerManager::Instance().RegisterController( \
36
      &controller::New, #controller);                                   \
37
  }
38
39
}  // namespace mahjong