blob: 98e45673480317292ae3f32de3c4d97ea04034fb [file] [log] [blame]
Francis Murtagh1f7db452019-08-14 09:49:34 +01001//
Jim Flynnbbfe6032020-07-20 16:57:44 +01002// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
Francis Murtagh1f7db452019-08-14 09:49:34 +01003// SPDX-License-Identifier: MIT
4//
5
6#include "CommandHandlerKey.hpp"
7
Jim Flynnbbfe6032020-07-20 16:57:44 +01008namespace arm
Aron Virginas-Tare898db92019-08-22 12:56:34 +01009{
10
Jim Flynnbbfe6032020-07-20 16:57:44 +010011namespace pipe
Aron Virginas-Tare898db92019-08-22 12:56:34 +010012{
13
Jim Flynn397043f2019-10-17 17:37:10 +010014uint32_t CommandHandlerKey::GetFamilyId() const
15{
16 return m_FamilyId;
17}
18
Francis Murtagh1f7db452019-08-14 09:49:34 +010019uint32_t CommandHandlerKey::GetPacketId() const
20{
21 return m_PacketId;
22}
23
24uint32_t CommandHandlerKey::GetVersion() const
25{
26 return m_Version;
27}
28
29bool CommandHandlerKey::operator<(const CommandHandlerKey& rhs) const
30{
31 bool result = true;
Jim Flynn397043f2019-10-17 17:37:10 +010032 if (m_FamilyId == rhs.m_FamilyId)
Francis Murtagh1f7db452019-08-14 09:49:34 +010033 {
Jim Flynn397043f2019-10-17 17:37:10 +010034 if (m_PacketId == rhs.m_PacketId)
35 {
36 result = m_Version < rhs.m_Version;
37 }
38 else if (m_PacketId > rhs.m_PacketId)
39 {
40 result = false;
41 }
Francis Murtagh1f7db452019-08-14 09:49:34 +010042 }
Jim Flynn397043f2019-10-17 17:37:10 +010043 else if (m_FamilyId > rhs.m_FamilyId)
Francis Murtagh1f7db452019-08-14 09:49:34 +010044 {
45 result = false;
46 }
Francis Murtagh1f7db452019-08-14 09:49:34 +010047 return result;
48}
49
50bool CommandHandlerKey::operator>(const CommandHandlerKey& rhs) const
51{
52 return rhs < *this;
53}
54
55bool CommandHandlerKey::operator<=(const CommandHandlerKey& rhs) const
56{
57 return !(*this > rhs);
58}
59
60bool CommandHandlerKey::operator>=(const CommandHandlerKey& rhs) const
61{
62 return !(*this < rhs);
63}
64
65bool CommandHandlerKey::operator==(const CommandHandlerKey& rhs) const
66{
Jim Flynn397043f2019-10-17 17:37:10 +010067 return m_FamilyId == rhs.m_FamilyId && m_PacketId == rhs.m_PacketId && m_Version == rhs.m_Version;
Francis Murtagh1f7db452019-08-14 09:49:34 +010068}
69
70bool CommandHandlerKey::operator!=(const CommandHandlerKey& rhs) const
71{
72 return !(*this == rhs);
73}
Aron Virginas-Tare898db92019-08-22 12:56:34 +010074
Jim Flynnbbfe6032020-07-20 16:57:44 +010075} // namespace pipe
Aron Virginas-Tare898db92019-08-22 12:56:34 +010076
Jim Flynnbbfe6032020-07-20 16:57:44 +010077} // namespace arm