message_compare.h 1.3 KB

1234567891011121314151617181920212223242526
  1. //
  2. // Created by zx on 2020/7/10.
  3. //
  4. #ifndef NNXX_TESTS_MESSAGE_COMPARE_H__H
  5. #define NNXX_TESTS_MESSAGE_COMPARE_H__H
  6. #define RegistoryCompare(NAMESPACE,NAME) \
  7. namespace NAMESPACE \
  8. { \
  9. static bool operator==(const NAME& msg1,const NAME& msg2){ \
  10. if(msg1.base_info().msg_type() == msg2.base_info().msg_type() \
  11. && msg1.base_info().sender() == msg2.base_info().sender() \
  12. && msg1.base_info().receiver() == msg2.base_info().receiver() \
  13. && msg1.command_id() == msg2.command_id()){ \
  14. return true; \
  15. }else{ \
  16. return false; \
  17. } \
  18. } \
  19. static bool operator<(const NAME& msg1,const NAME& msg2){ \
  20. return msg1.command_id() < msg2.command_id(); \
  21. } \
  22. }
  23. #endif //NNXX_TESTS_MESSAGE_COMPARE_H