aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/CommandHandlerKey.cpp
diff options
context:
space:
mode:
authorFrancis Murtagh <francis.murtagh@arm.com>2019-08-14 09:49:34 +0100
committerFrancis Murtagh <francis.murtagh@arm.com>2019-08-14 09:49:34 +0100
commit1f7db45b73522752115ea482d1e85e88c044a664 (patch)
tree5f338c8cce8db41720be973de7bc9eb137a1e3fe /src/profiling/CommandHandlerKey.cpp
parent566e4adc16e4aa3bc1107c32af5df45f027424ca (diff)
downloadarmnn-1f7db45b73522752115ea482d1e85e88c044a664.tar.gz
IVGCVSW-3416 Create Command Handler Key class
* Add CommandHandlerKey class with all comparison operators * Add UnitTests to check key sorting in collection Change-Id: Icbd493d1e51e681cbe22a9e70ab9428a8a2ad107 Signed-off-by: Francis Murtagh <francis.murtagh@arm.com>
Diffstat (limited to 'src/profiling/CommandHandlerKey.cpp')
-rw-r--r--src/profiling/CommandHandlerKey.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/profiling/CommandHandlerKey.cpp b/src/profiling/CommandHandlerKey.cpp
new file mode 100644
index 0000000000..6ce73440b8
--- /dev/null
+++ b/src/profiling/CommandHandlerKey.cpp
@@ -0,0 +1,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);
+}