app.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include "define.h"
  3. #include "base/error.h"
  4. #include "net/http_center.h"
  5. #include "core/subscribemanager.h"
  6. #include "core/interceptormanager.h"
  7. #include "core/statemanager.h"
  8. #include "core/config.h"
  9. #include "core/log.h"
  10. #include "core/global.h"
  11. #include "core/global_module.h"
  12. namespace fastweb
  13. {
  14. class app :public ylib::error_base {
  15. public:
  16. app();
  17. ~app();
  18. bool start(const std::string& config_filepath);
  19. void stop();
  20. private:
  21. /// <summary>
  22. /// 初始化执行脚本
  23. /// </summary>
  24. /// <returns></returns>
  25. bool initialization_script();
  26. private:
  27. // 初始化脚本虚拟机
  28. luastate* m_state_init = nullptr;
  29. // 网站服务核心
  30. network::http::center* m_center = nullptr;
  31. public:
  32. // 网站路由
  33. network::http::router* router = nullptr;
  34. // 日志
  35. std::shared_ptr<fastweb::log> log;
  36. // 订阅管理器
  37. std::shared_ptr<fastweb::subscribe_manager> subscribe;
  38. // 拦截器管理器
  39. std::shared_ptr<fastweb::interceptor_manager> interceptor;
  40. // LUA状态管理器
  41. std::shared_ptr<fastweb::state_manager> state;
  42. // 配置
  43. std::shared_ptr<fastweb::config> config;
  44. // 应用全局变量
  45. std::shared_ptr<fastweb::global> global;
  46. // 全局托管模块
  47. std::shared_ptr<fastweb::global_module> gloabl_module;
  48. };
  49. }