IVGCVSW-3951 Create the timeline decoder

 * Added ITimelineDecoder.h C interface
 * Added an example implementation of ITimelineDecoder.h
 * Added command handlers for the timeline directory and objects
 * Added tests for the decoder implementation
 * Changed ReadSwTraceMessage to take a const unsigned char*
   so it can be used by the directory command handler
 * Fixed some bugs in ProfilingUtils.cpp and related tests

Change-Id: If06faf1fe0274a8f022f194a6d3527f5ce5374c6
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
diff --git a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp b/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp
new file mode 100644
index 0000000..3f32404
--- /dev/null
+++ b/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp
@@ -0,0 +1,66 @@
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include "ITimelineDecoder.h"
+
+#include <CommandHandlerFunctor.hpp>
+#include <Packet.hpp>
+#include <ProfilingUtils.hpp>
+
+namespace armnn
+{
+
+namespace gatordmock
+{
+
+class TimelineCaptureCommandHandler : public profiling::CommandHandlerFunctor
+{
+    // Utils
+    uint32_t uint32_t_size = sizeof(uint32_t);
+    uint32_t uint64_t_size = sizeof(uint64_t);
+    uint32_t threadId_size = sizeof(std::thread::id);
+
+    using ReadFunction = void (TimelineCaptureCommandHandler::*)(const unsigned char*, uint32_t);
+
+public:
+    TimelineCaptureCommandHandler(uint32_t familyId,
+                                  uint32_t packetId,
+                                  uint32_t version,
+                                  Model* model,
+                                  bool quietOperation = false)
+            : CommandHandlerFunctor(familyId, packetId, version)
+            , m_Model(model)
+            , m_QuietOperation(quietOperation)
+    {}
+
+    void operator()(const armnn::profiling::Packet& packet) override;
+
+    void ReadLabel(const unsigned char* data, uint32_t offset);
+    void ReadEntity(const unsigned char* data, uint32_t offset);
+    void ReadEventClass(const unsigned char* data, uint32_t offset);
+    void ReadRelationship(const unsigned char* data, uint32_t offset);
+    void ReadEvent(const unsigned char* data, uint32_t offset);
+
+    void print();
+
+private:
+    void ParseData(const armnn::profiling::Packet& packet);
+
+    Model* m_Model;
+    bool m_QuietOperation;
+    static const ReadFunction m_ReadFunctions[];
+
+    void printLabels();
+    void printEntities();
+    void printEventClasses();
+    void printRelationships();
+    void printEvents();
+};
+
+} //namespace gatordmock
+
+} //namespace armnn