HepuPlugin.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. void SendTarget2(HepuTarget2& HepuTargetMsg);
  36. bool Alive();
  37. virtual bool RestPlugin();
  38. ~HepuPlugin(){}
  39. protected:
  40. std::shared_ptr<Hepu> m_hepuClient = nullptr;
  41. std::shared_ptr<ThreadPool> pool = nullptr;
  42. bool stop_ = false;
  43. };
  44. }
  45. #endif