module_mgr.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef MODULE_MGR_H
  2. #define MODULE_MGR_H
  3. /**
  4. * @brief 业务模块的管理类,包括:
  5. * 1、初始化(init:注册web回调函数,读数据库初始化事件列表)
  6. * 2、启动线程start:向web发送事件
  7. * 3、结束线程stop
  8. * @author 戴月腾
  9. * @date 2018-08-25
  10. */
  11. #include"module_web.h"
  12. #include"module_area.h"
  13. #include"module_call_help.h"
  14. class module_mgr: public singleton_base<module_mgr>
  15. {
  16. private:
  17. friend class singleton_base<module_mgr>;
  18. module_mgr()
  19. {
  20. }
  21. public:
  22. /**
  23. * @brief 注册web回调函数,读数据库初始化事件列表
  24. */
  25. void init(std::map<std::string, YA::MSG_HANDLE_FUNC_TYPE>& MsgFuncList)
  26. {
  27. module_web::instance()->init(MsgFuncList);
  28. module_area::instance()->init();
  29. module_call_help::instance()->init();
  30. }
  31. /**
  32. * @brief 启动线程start:向web发送事件
  33. */
  34. void start()
  35. {
  36. module_area::instance()->start();
  37. module_call_help::instance()->start();
  38. }
  39. /**
  40. * @brief 结束线程stop
  41. */
  42. void stop()
  43. {
  44. module_area::instance()->stop();
  45. module_call_help::instance()->stop();
  46. }
  47. };
  48. #endif // MODULE_MGR_H