HepuPlugin.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef __HEPUPLUGHIN_HPP_
  2. #define __HEPUPLUGHIN_HPP_
  3. #include <iostream>
  4. #include <ctime>
  5. #include <chrono>
  6. #include "UtilBase.hpp"
  7. #include "Util/util.h"
  8. #include "Util/logger.h"
  9. #include "Util/TimeTicker.h"
  10. #include "Util/NoticeCenter.h"
  11. #include "config.hpp"
  12. #include "requests.hpp"
  13. #include "Hepu.hpp"
  14. #include "PluginSubscriber.hpp"
  15. #define HEPU_USR "sunwin"
  16. #define HEPU_IP "0.0.0.0"
  17. #define HEPU_PORT 80
  18. using namespace std;
  19. using namespace toolkit;
  20. namespace gsd
  21. {
  22. class HepuPlugin: public PluginSubscriber<HepuPlugin>, public PluginBase
  23. {
  24. private:
  25. HepuPlugin(): PluginBase(){
  26. }
  27. public:
  28. using Ptr = std::shared_ptr<HepuPlugin>;
  29. static std::shared_ptr<HepuPlugin> getPtr();
  30. bool Init();
  31. bool StartTask();
  32. void Destroy();
  33. void HBThrd();
  34. void SendTarget(HepuTarget& HepuTargetMsg);
  35. bool Alive();
  36. virtual bool RestPlugin();
  37. ~HepuPlugin(){}
  38. protected:
  39. std::shared_ptr<Hepu> m_hepuClient = nullptr;
  40. std::shared_ptr<ThreadPool> pool = nullptr;
  41. bool stop_ = false;
  42. };
  43. }
  44. #endif