dispatch_excutor.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // Created by zx on 2020/7/21.
  3. //
  4. #ifndef NNXX_TESTS_DISPATCH_COMMUNICATOR_H
  5. #define NNXX_TESTS_DISPATCH_COMMUNICATOR_H
  6. #include "message_communicator.h"
  7. #include "singleton.h"
  8. #include "dispatch_message.pb.h"
  9. #include "thread_safe_map.h"
  10. class Dispatch_excutor :public Singleton<Dispatch_excutor>
  11. {
  12. friend Singleton<Dispatch_excutor>;
  13. public:
  14. virtual ~Dispatch_excutor();
  15. Error_manager dispatch_request(message::Dispatch_request_msg& request,
  16. message::Dispatch_response_msg& result,Thread_condition& cancel_condition);
  17. /*
  18. * 提前取消请求
  19. */
  20. Error_manager cancel_request(message::Dispatch_request_msg& request);
  21. /*
  22. * 系统急停
  23. */
  24. //检查停车入口 调度节点状态
  25. Error_manager check_entrance_statu(int terminal_id);
  26. //检查取车出口 调度节点状态
  27. Error_manager check_export_statu(int terminal_id);
  28. //消费本模块的接收消息
  29. Error_manager consume_msg(Communication_message* p_msg);
  30. protected:
  31. Dispatch_excutor();
  32. private:
  33. thread_safe_map<std::string,message::Dispatch_response_msg> m_response_table;
  34. //停车调度模块状态
  35. thread_safe_map<int,message::Dispatch_terminal_status_msg> m_storing_dispatch_statu_msg_map;
  36. thread_safe_map<int,std::chrono::system_clock::time_point> m_storing_dispatch_statu_time_map;
  37. //取车调度模块状态
  38. thread_safe_map<int,message::Dispatch_terminal_status_msg> m_picking_dispatch_statu_msg_map;
  39. thread_safe_map<int,std::chrono::system_clock::time_point> m_picking_dispatch_statu_time_map;
  40. };
  41. #endif //NNXX_TESTS_DISPATCH_COMMUNICATOR_H