// // Created by zx on 2020/7/10. // #ifndef NNXX_TESTS_MESSAGE_COMPARE_H__H #define NNXX_TESTS_MESSAGE_COMPARE_H__H namespace message { static bool operator==(const message::Command_info &msg1, const message::Command_info &msg2) { return (msg1.event() == msg2.event()) && (0==msg1.time().compare(msg2.time())) && (0==msg1.place().compare(msg2.place())); } static bool operator!=(const message::Command_info &msg1, const message::Command_info &msg2) { return msg1.event() != msg2.event() ||0!= msg1.time().compare(msg2.time()) || 0!=msg1.place().compare(msg2.place()); } static bool operator<(const message::Command_info &msg1, const message::Command_info &msg2) { return msg1.time().compare(msg2.time()) < 0 || msg1.place().compare(msg2.place())<0 || msg1.event()(const message::Command_info &msg1, const message::Command_info &msg2) { LOG(WARNING)<<">>>>>>>>>>>"<0; }*/ } #define RegistoryCompare(NAMESPACE,NAME) \ namespace NAMESPACE \ { \ static bool operator==(const NAME& msg1,const NAME& msg2){ \ if(msg1.base_info().msg_type() == msg2.base_info().msg_type() \ && msg1.base_info().sender() == msg2.base_info().sender() \ && msg1.base_info().receiver() == msg2.base_info().receiver() \ && msg1.command_info() == msg2.command_info()){ \ return true; \ }else{ \ return false; \ } \ } \ static bool operator<(const NAME& msg1,const NAME& msg2){ \ return msg1.command_info() < msg2.command_info(); \ } \ } #endif //NNXX_TESTS_MESSAGE_COMPARE_H