// // Created by zx on 2020/6/18. // #ifndef PARKSPACE_ALLOCATION_COMMUNICATOR_H #define PARKSPACE_ALLOCATION_COMMUNICATOR_H #include #include "communication_socket_base.h" #include "singleton.h" #include "parkspace_allocation_message.pb.h" #include "error_code.h" class Parkspace_communicator: public Singleton, public Communication_socket_base { friend Singleton; private: Parkspace_communicator(); public: virtual ~Parkspace_communicator(); //外部调用,反馈结果消息 Error_manager send_response(Communication_message* message); //封装反馈消息,加入队列父类自行发送 virtual Error_manager encapsulate_msg(Communication_message* message); //封装发送消息 virtual Error_manager encapsulate_msg(std::string message); protected: //解析车位分配请求消息具体内容,激活车位分配单例处理函数(不可阻塞),获得结果后由车位分配单例封装消息发送 virtual Error_manager execute_msg(Communication_message* p_msg); //检查是否接收到本模块需要的消息,重载后父类自行调用判断 virtual Error_manager check_msg(Communication_message* p_msg); //重载检查执行者函数,判断执行者状态 virtual Error_manager check_executer(Communication_message* p_msg); //心跳与车位实时信息 virtual Error_manager encapsulate_send_data(); }; #endif //PARKSPACE_ALLOCATION_COMMUNICATOR_H