123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- //
- // Created by zx on 2020/6/18.
- //
- #ifndef NNXX_TESTS_LOCATE_COMMUNICATOR_H
- #define NNXX_TESTS_LOCATE_COMMUNICATOR_H
- #include <mutex>
- #include "message_communicator.h"
- #include "measure_message.pb.h"
- #include "thread_safe_map.h"
- /*
- * 注册消息的比较函数,用于重载==与<符号,使其可以用作map中的key
- */
- class Measure_excutor: public Singleton<Measure_excutor>
- {
- friend Singleton<Measure_excutor>;
- public:
- virtual ~Measure_excutor();
- Error_manager locate_request(message::Measure_request_msg& request,
- message::Measure_response_msg& result,Thread_condition& cancel_condition);
- Error_manager consume_msg(Communication_message* p_msg);
- /*
- * 提前取消请求
- */
- Error_manager cancel_request(message::Measure_request_msg& request);
- Error_manager check_statu(int terminal_id);
- protected:
- Measure_excutor();
- protected:
- thread_safe_map<std::string,message::Measure_response_msg> m_response_table;
- thread_safe_map<int ,message::Measure_status_msg > m_measure_statu_msg_map;
- thread_safe_map<int ,std::chrono::system_clock::time_point> m_statu_recv_time_map;
- };
- #endif //NNXX_TESTS_LOCATE_COMMUNICATOR_H
|