ModuleHTTP.h 730 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef MDD_MODULEHTTP_H
  2. #define MDD_MODULEHTTP_H
  3. #include "ModuleBase.h"
  4. #include <httplib.h>
  5. #ifdef WIN32
  6. #else
  7. #include <unistd.h>
  8. #endif
  9. using namespace httplib;
  10. namespace mdd{
  11. class ModuleHTTP : public ModuleBase{
  12. private:
  13. std::string _fname;
  14. std::string _id;
  15. int _port;
  16. #ifdef WIN32
  17. #else
  18. pid_t _child_pid = 0;
  19. #endif
  20. protected:
  21. bool connect();
  22. std::string str_to_json(const std::string& input);
  23. bool updateInputs();
  24. bool updateOutputs();
  25. void updateLayout();
  26. public:
  27. ModuleHTTP(std::string fname, std::string id, int port);
  28. ~ModuleHTTP();
  29. bool update() override;
  30. };
  31. }
  32. #endif //MDD_MODULEHTTP_H