Francis Murtagh | 1f7db45 | 2019-08-14 09:49:34 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "CommandHandlerKey.hpp" |
| 7 | |
| 8 | uint32_t CommandHandlerKey::GetPacketId() const |
| 9 | { |
| 10 | return m_PacketId; |
| 11 | } |
| 12 | |
| 13 | uint32_t CommandHandlerKey::GetVersion() const |
| 14 | { |
| 15 | return m_Version; |
| 16 | } |
| 17 | |
| 18 | bool CommandHandlerKey::operator<(const CommandHandlerKey& rhs) const |
| 19 | { |
| 20 | bool result = true; |
| 21 | |
| 22 | if (m_PacketId == rhs.m_PacketId) |
| 23 | { |
| 24 | result = m_Version < rhs.m_Version; |
| 25 | } |
| 26 | else if (m_PacketId > rhs.m_PacketId) |
| 27 | { |
| 28 | result = false; |
| 29 | } |
| 30 | |
| 31 | return result; |
| 32 | } |
| 33 | |
| 34 | bool CommandHandlerKey::operator>(const CommandHandlerKey& rhs) const |
| 35 | { |
| 36 | return rhs < *this; |
| 37 | } |
| 38 | |
| 39 | bool CommandHandlerKey::operator<=(const CommandHandlerKey& rhs) const |
| 40 | { |
| 41 | return !(*this > rhs); |
| 42 | } |
| 43 | |
| 44 | bool CommandHandlerKey::operator>=(const CommandHandlerKey& rhs) const |
| 45 | { |
| 46 | return !(*this < rhs); |
| 47 | } |
| 48 | |
| 49 | bool CommandHandlerKey::operator==(const CommandHandlerKey& rhs) const |
| 50 | { |
| 51 | return m_PacketId == rhs.m_PacketId && m_Version == rhs.m_Version; |
| 52 | } |
| 53 | |
| 54 | bool CommandHandlerKey::operator!=(const CommandHandlerKey& rhs) const |
| 55 | { |
| 56 | return !(*this == rhs); |
| 57 | } |