aboutsummaryrefslogtreecommitdiff
path: root/src/timelineDecoder/TimelineDecoder.hpp
blob: 2efdc4483b1e7be97da95416f970e1965317edf1 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// Copyright © 2020 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once

#include <armnn/profiling/ITimelineDecoder.hpp>

#include <vector>

namespace armnn
{
namespace timelinedecoder
{
class TimelineDecoder : public ITimelineDecoder
{

public:

    struct Model
    {
        std::vector<Entity> m_Entities;
        std::vector<EventClass> m_EventClasses;
        std::vector<Event> m_Events;
        std::vector<Label> m_Labels;
        std::vector<Relationship> m_Relationships;
    };

    using OnNewEntityCallback       =  void (*)(Model &, const Entity);
    using OnNewEventClassCallback   =  void (*)(Model &, const EventClass);
    using OnNewEventCallback        =  void (*)(Model &, const Event);
    using OnNewLabelCallback        =  void (*)(Model &, const Label);
    using OnNewRelationshipCallback =  void (*)(Model &, const Relationship);

    virtual TimelineStatus CreateEntity(const Entity &) override;
    virtual TimelineStatus CreateEventClass(const EventClass &) override;
    virtual TimelineStatus CreateEvent(const Event &) override;
    virtual TimelineStatus CreateLabel(const Label &) override;
    virtual TimelineStatus CreateRelationship(const Relationship &) override;

    const Model& GetModel();

    TimelineStatus SetEntityCallback(const OnNewEntityCallback);
    TimelineStatus SetEventClassCallback(const OnNewEventClassCallback);
    TimelineStatus SetEventCallback(const OnNewEventCallback);
    TimelineStatus SetLabelCallback(const OnNewLabelCallback);
    TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback);

    void SetDefaultCallbacks();

    void print();

private:
    Model m_Model;

    OnNewEntityCallback m_OnNewEntityCallback;
    OnNewEventClassCallback m_OnNewEventClassCallback;
    OnNewEventCallback m_OnNewEventCallback;
    OnNewLabelCallback m_OnNewLabelCallback;
    OnNewRelationshipCallback m_OnNewRelationshipCallback;

    void printLabels();
    void printEntities();
    void printEventClasses();
    void printRelationships();
    void printEvents();
};

}
}