// // Created by zx on 2020/7/9. // #ifndef NNXX_TESTS_PARKSPACE_COMMUNICATOR_H #define NNXX_TESTS_PARKSPACE_COMMUNICATOR_H #include "message_communicator.h" #include #include "thread_safe_map.h" #include "communication_message.h" class Parkspace_excutor :public Singleton { friend Singleton; public: virtual ~Parkspace_excutor(); /* * 请求分配车位 */ Error_manager alloc_request(message::Parkspace_allocation_request_msg& request, message::Parkspace_allocation_response_msg& result,Thread_condition& cancel_condition); /* * 查询车辆所在位置请求 */ Error_manager search_request(message::Parkspace_search_request_msg& request, message::Parkspace_search_response_msg& response,Thread_condition& cancel_condition); /* * 释放车位请求(停车失败或者取车完成时调用) */ Error_manager release_request(message::Parkspace_release_request_msg& request, message::Parkspace_release_response_msg& response,Thread_condition& cancel_condition); /* * 确认占用车位消息 */ Error_manager confirm_request(message::Parkspace_confirm_alloc_request_msg& request, message::Parkspace_confirm_alloc_response_msg& response,Thread_condition& cancel_condition); Error_manager consume_msg(Communication_message* p_msg); Error_manager check_statu(); protected: Parkspace_excutor(); protected: thread_safe_map m_alloc_table; thread_safe_map m_search_table; thread_safe_map m_release_table; thread_safe_map m_confirm_table; message::Parkspace_allocation_status_msg m_parkspace_status_msg; std::chrono::system_clock::time_point m_parkspace_statu_time; }; #endif //NNXX_TESTS_PARKSPACE_COMMUNICATOR_H