Finn Williams | 510f618 | 2020-02-21 11:14:08 +0000 | [diff] [blame^] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | #pragma once |
| 6 | |
| 7 | #include "ITimelineDecoder.hpp" |
| 8 | #include <vector> |
| 9 | namespace armnn |
| 10 | { |
| 11 | class TimelineDecoder : public ITimelineDecoder |
| 12 | { |
| 13 | |
| 14 | public: |
| 15 | |
| 16 | struct Model |
| 17 | { |
| 18 | std::vector<Entity> m_Entities; |
| 19 | std::vector<EventClass> m_EventClasses; |
| 20 | std::vector<Event> m_Events; |
| 21 | std::vector<Label> m_Labels; |
| 22 | std::vector<Relationship> m_Relationships; |
| 23 | }; |
| 24 | |
| 25 | using OnNewEntityCallback = void (*)(Model &, const Entity); |
| 26 | using OnNewEventClassCallback = void (*)(Model &, const EventClass); |
| 27 | using OnNewEventCallback = void (*)(Model &, const Event); |
| 28 | using OnNewLabelCallback = void (*)(Model &, const Label); |
| 29 | using OnNewRelationshipCallback = void (*)(Model &, const Relationship); |
| 30 | |
| 31 | virtual ErrorCode CreateEntity(const Entity &) override; |
| 32 | virtual ErrorCode CreateEventClass(const EventClass &) override; |
| 33 | virtual ErrorCode CreateEvent(const Event &) override; |
| 34 | virtual ErrorCode CreateLabel(const Label &) override; |
| 35 | virtual ErrorCode CreateRelationship(const Relationship &) override; |
| 36 | |
| 37 | const Model& GetModel(); |
| 38 | |
| 39 | |
| 40 | ErrorCode SetEntityCallback(const OnNewEntityCallback); |
| 41 | ErrorCode SetEventClassCallback(const OnNewEventClassCallback); |
| 42 | ErrorCode SetEventCallback(const OnNewEventCallback); |
| 43 | ErrorCode SetLabelCallback(const OnNewLabelCallback); |
| 44 | ErrorCode SetRelationshipCallback(const OnNewRelationshipCallback); |
| 45 | |
| 46 | void print(); |
| 47 | |
| 48 | private: |
| 49 | Model m_Model; |
| 50 | |
| 51 | OnNewEntityCallback m_OnNewEntityCallback; |
| 52 | OnNewEventClassCallback m_OnNewEventClassCallback; |
| 53 | OnNewEventCallback m_OnNewEventCallback; |
| 54 | OnNewLabelCallback m_OnNewLabelCallback; |
| 55 | OnNewRelationshipCallback m_OnNewRelationshipCallback; |
| 56 | |
| 57 | void printLabels(); |
| 58 | void printEntities(); |
| 59 | void printEventClasses(); |
| 60 | void printRelationships(); |
| 61 | void printEvents(); |
| 62 | }; |
| 63 | } |