system_communication.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // Created by huli on 2020/6/28.
  3. //
  4. #ifndef NNXX_TESTS_SYSTEM_COMMUNICATION_H
  5. #define NNXX_TESTS_SYSTEM_COMMUNICATION_H
  6. #include "../tool/singleton.h"
  7. #include "../communication/communication_socket_base.h"
  8. class System_communication:public Singleton<System_communication>, public Communication_socket_base
  9. {
  10. // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
  11. friend class Singleton<System_communication>;
  12. private:
  13. // 父类的构造函数必须保护,子类的构造函数必须私有。
  14. System_communication();
  15. public:
  16. //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
  17. System_communication(const System_communication& other) = delete;
  18. System_communication& operator =(const System_communication& other) = delete;
  19. ~System_communication();
  20. public://API functions
  21. //定时封装发送消息, 一般为心跳和状态信息, 需要子类重载
  22. virtual Error_manager encapsulate_send_data();
  23. public://get or set member variable
  24. protected://member variable
  25. private:
  26. };
  27. #endif //NNXX_TESTS_SYSTEM_COMMUNICATION_H