aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/CommandHandlerKey.cpp
blob: 6ce73440b84ab7a50be2cf964dfa7993f77ae789 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "CommandHandlerKey.hpp"

uint32_t CommandHandlerKey::GetPacketId() const
{
    return m_PacketId;
}

uint32_t CommandHandlerKey::GetVersion() const
{
    return m_Version;
}

bool CommandHandlerKey::operator<(const CommandHandlerKey& rhs) const
{
    bool result = true;

    if (m_PacketId == rhs.m_PacketId)
    {
        result = m_Version < rhs.m_Version;
    }
    else if (m_PacketId > rhs.m_PacketId)
    {
        result = false;
    }

    return result;
}

bool CommandHandlerKey::operator>(const CommandHandlerKey& rhs) const
{
    return rhs < *this;
}

bool CommandHandlerKey::operator<=(const CommandHandlerKey& rhs) const
{
    return !(*this > rhs);
}

bool CommandHandlerKey::operator>=(const CommandHandlerKey& rhs) const
{
    return !(*this < rhs);
}

bool CommandHandlerKey::operator==(const CommandHandlerKey& rhs) const
{
    return m_PacketId == rhs.m_PacketId && m_Version == rhs.m_Version;
}

bool CommandHandlerKey::operator!=(const CommandHandlerKey& rhs) const
{
    return !(*this == rhs);
}