system_communication_mq.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * @Author: yct 18202736439@163.com
  3. * @Date: 2022-09-30 18:09:07
  4. * @LastEditors: yct 18202736439@163.com
  5. * @LastEditTime: 2022-09-30 18:35:01
  6. * @FilePath: /puai_wj_2021/system/system_communication_mq.h
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. //
  10. // Created by huli on 2020/6/28.
  11. //
  12. #ifndef NNXX_TESTS_SYSTEM_COMMUNICATION_MQ_H
  13. #define NNXX_TESTS_SYSTEM_COMMUNICATION_MQ_H
  14. #include "../tool/singleton.h"
  15. #include "../rabbitmq/rabbitmq_base.h"
  16. class System_communication_mq:public Singleton<System_communication_mq>, public Rabbitmq_base
  17. {
  18. // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
  19. friend class Singleton<System_communication_mq>;
  20. private:
  21. // 父类的构造函数必须保护,子类的构造函数必须私有。
  22. System_communication_mq();
  23. public:
  24. //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
  25. System_communication_mq(const System_communication_mq& other) = delete;
  26. System_communication_mq& operator =(const System_communication_mq& other) = delete;
  27. ~System_communication_mq();
  28. public://API functions
  29. //检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
  30. virtual Error_manager check_msg(Rabbitmq_message* p_msg);
  31. //检查执行者的状态, 判断能否处理这条消息, 需要子类重载
  32. virtual Error_manager check_executer(Rabbitmq_message* p_msg);
  33. //处理消息, 需要子类重载
  34. virtual Error_manager execute_msg(Rabbitmq_message* p_msg);
  35. //定时封装发送消息, 一般为心跳和状态信息, 需要子类重载
  36. virtual Error_manager auto_encapsulate_status();
  37. public://get or set member variable
  38. protected://member variable
  39. private:
  40. };
  41. #endif //NNXX_TESTS_SYSTEM_COMMUNICATION_MQ_H