blob: 6ce73440b84ab7a50be2cf964dfa7993f77ae789 [file] [log] [blame]
Francis Murtagh1f7db452019-08-14 09:49:34 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "CommandHandlerKey.hpp"
7
8uint32_t CommandHandlerKey::GetPacketId() const
9{
10 return m_PacketId;
11}
12
13uint32_t CommandHandlerKey::GetVersion() const
14{
15 return m_Version;
16}
17
18bool 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
34bool CommandHandlerKey::operator>(const CommandHandlerKey& rhs) const
35{
36 return rhs < *this;
37}
38
39bool CommandHandlerKey::operator<=(const CommandHandlerKey& rhs) const
40{
41 return !(*this > rhs);
42}
43
44bool CommandHandlerKey::operator>=(const CommandHandlerKey& rhs) const
45{
46 return !(*this < rhs);
47}
48
49bool CommandHandlerKey::operator==(const CommandHandlerKey& rhs) const
50{
51 return m_PacketId == rhs.m_PacketId && m_Version == rhs.m_Version;
52}
53
54bool CommandHandlerKey::operator!=(const CommandHandlerKey& rhs) const
55{
56 return !(*this == rhs);
57}