exception_solver.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // Created by zx on 2020/8/20.
  3. //
  4. #ifndef NNXX_TESTS_ERROR_HANDLING_H
  5. #define NNXX_TESTS_ERROR_HANDLING_H
  6. #include "communication_socket_base.h"
  7. #include "singleton.h"
  8. #include "dispatch_message.pb.h"
  9. #include "error_code.h"
  10. #include "thread_safe_map.h"
  11. #include "StoreProcessTask.h"
  12. #include "PickupProcessTask.h"
  13. class Exception_solver :public Singleton<Exception_solver>, public Communication_socket_base
  14. {
  15. friend Singleton<Exception_solver>;
  16. public:
  17. virtual ~Exception_solver();
  18. /*
  19. * 添加流程的任务取消标志位
  20. * license:车牌号,作为流程任务的唯一标识
  21. */
  22. Error_manager add_task_cancel_condition(std::string license,tq::BaseTask* task);
  23. /*
  24. * 删除流程的任务取消标志位
  25. * license:车牌号,作为流程任务的唯一标识
  26. */
  27. Error_manager delete_task_cancel_condition(std::string license);
  28. /*
  29. * 处理故障
  30. */
  31. Error_manager solve_exception(Error_manager code,tq::BaseTask* task);
  32. protected:
  33. Exception_solver();
  34. virtual Error_manager encapsulate_msg(Communication_message* message);
  35. virtual Error_manager execute_msg(Communication_message* p_msg);
  36. /*
  37. * 检测消息是否可被处理
  38. */
  39. virtual Error_manager check_msg(Communication_message* p_msg);
  40. /*
  41. * 心跳发送函数,重载
  42. */
  43. virtual Error_manager encapsulate_send_data();
  44. //检查消息是否可以被解析, 需要重载
  45. virtual Error_manager check_executer(Communication_message* p_msg);
  46. private:
  47. thread_safe_map<std::string,tq::BaseTask*> m_ptask_map;
  48. };
  49. #endif //NNXX_TESTS_ERROR_HANDLING_H