123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //
- // Created by zx on 2020/7/14.
- //
- /*
- * 指令管理, 包括指令的接收,指令的执行控制,指令的状态追踪,出入口状态检查
- */
- #ifndef NNXX_TESTS_COMMAND_MANAGER_H
- #define NNXX_TESTS_COMMAND_MANAGER_H
- #include <error_code.h>
- #include <terminal_message.pb.h>
- #include <communication_message.h>
- #include "thread_condition.h"
- #include "singleton.h"
- #include "TaskQueue/TQFactory.h"
- #include "TaskQueue/BaseTask.h"
- #include "process_message.pb.h"
- #include "thread_safe_map.h"
- #include "system_setting.pb.h"
- class Command_manager :public Singleton<Command_manager>{
- friend Singleton<Command_manager>;
- public:
- ~Command_manager();
- /*
- * 初始化函数,创建线程池,创建状态广播线程,根据配置创建停取车流程
- */
- Error_manager init(setting::System_setting system_setting);
- /*
- * 执行停车请求
- */
- Error_manager execute_store_command(message::Store_command_request_msg& request,message::Store_command_response_msg& response);
- /*
- * 执行取车请求
- */
- Error_manager execute_pickup_command(message::Pickup_command_request_msg& request,message::Pickup_command_response_msg& response);
- private:
- Command_manager();
- protected:
- /*
- * 停取车终端 map,key值为终端编号,value为终端指令执行器task,可放入线程池执行流程
- */
- thread_safe_map<int,tq::BaseTask*> m_store_command_task_map;
- thread_safe_map<int,tq::BaseTask*> m_pick_command_task_map;
- tq::IQueue* m_thread_queue_process; //指令流程线程池
- };
- #endif //NNXX_TESTS_COMMAND_MANAGER_H
|