123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- //
- // 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()<msg2.event();
- }
- /*static bool operator>(const message::Command_info &msg1, const message::Command_info &msg2) {
- LOG(WARNING)<<">>>>>>>>>>>"<<msg1.time().compare(msg2.time());
- return msg1.time().compare(msg2.time())>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
|