UserApp.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-04-06 08:46:22
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-06-15 17:00:16
  8. */
  9. #ifndef __USERAPP_HPP_
  10. #define __USERAPP_HPP_
  11. #include "ins_base.hpp"
  12. #include "Util/logger.h"
  13. #include "Util/NoticeCenter.h"
  14. #include "GetCenter.hpp"
  15. #include "ProcessingIt.hpp"
  16. #include "TaskCenter.hpp"
  17. #include "Disposition.hpp"
  18. #include "dataTypeList.hpp"
  19. #include <iostream>
  20. #include "ins_version.hpp"
  21. #include "Inspector.hpp"
  22. #include "Sectorpower.hpp"
  23. #include <drogon/drogon.h>
  24. using namespace std;
  25. using namespace toolkit;
  26. namespace ins
  27. {
  28. class userApp: public Module
  29. {
  30. private:
  31. userApp() : Module("userApp"){
  32. }
  33. public:
  34. using Ptr = std::shared_ptr<userApp>;
  35. /**
  36. * @description: 创建新的实例
  37. * @param {*}
  38. * @return {*}
  39. */
  40. static std::shared_ptr<userApp> CreateNew();
  41. /**
  42. * @description: 获取ptr
  43. * @param {*}
  44. * @return {*}
  45. */
  46. static std::shared_ptr<userApp> getPtr();
  47. ~userApp(){this->Destroy();}
  48. /**
  49. * @description: 初始化
  50. * @param {string} Name
  51. * @return {*}
  52. */
  53. int8_t Init(std::string Name);
  54. /**
  55. * @description: 初始化
  56. * @param {*}
  57. * @return {*}
  58. */
  59. int8_t Init() override;
  60. /**
  61. * @description: 释放资源
  62. * @param {*}
  63. * @return {*}
  64. */
  65. void Destroy() override;
  66. /**
  67. * @description: 是否正常
  68. * @param {*}
  69. * @return {*}
  70. */
  71. bool isNormally() override{
  72. return true;
  73. }
  74. /**
  75. * @description: 开始任务
  76. * @return {*}
  77. */
  78. int8_t StartTask();
  79. private:
  80. std::string appName = "";
  81. // 配置中心
  82. Disposition::Ptr m_disposition = nullptr;
  83. // 数据中心
  84. GetCenter::Ptr m_getCenter = nullptr;
  85. // 任务中心
  86. TaskCenter::Ptr m_taskCenter = nullptr;
  87. };
  88. } // namespace INS
  89. #endif