ArmNN
 20.05
TimelineDecoder Class Reference

#include <TimelineDecoder.hpp>

Inheritance diagram for TimelineDecoder:
ITimelineDecoder

Classes

struct  Model
 

Public Types

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)
 
- Public Types inherited from ITimelineDecoder
enum  TimelineStatus { TimelineStatus_Success, TimelineStatus_Fail }
 
enum  RelationshipType { RetentionLink, ExecutionLink, DataLink, LabelLink }
 

Public Member Functions

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 ModelGetModel ()
 
TimelineStatus SetEntityCallback (const OnNewEntityCallback)
 
TimelineStatus SetEventClassCallback (const OnNewEventClassCallback)
 
TimelineStatus SetEventCallback (const OnNewEventCallback)
 
TimelineStatus SetLabelCallback (const OnNewLabelCallback)
 
TimelineStatus SetRelationshipCallback (const OnNewRelationshipCallback)
 
void SetDefaultCallbacks ()
 
void print ()
 
- Public Member Functions inherited from ITimelineDecoder
virtual ~ITimelineDecoder ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from ITimelineDecoder
static char const * GetRelationshipAsCString (RelationshipType rType)
 

Detailed Description

Definition at line 15 of file TimelineDecoder.hpp.

Member Typedef Documentation

◆ OnNewEntityCallback

using OnNewEntityCallback = void (*)(Model &, const Entity)

Definition at line 29 of file TimelineDecoder.hpp.

◆ OnNewEventCallback

using OnNewEventCallback = void (*)(Model &, const Event)

Definition at line 31 of file TimelineDecoder.hpp.

◆ OnNewEventClassCallback

using OnNewEventClassCallback = void (*)(Model &, const EventClass)

Definition at line 30 of file TimelineDecoder.hpp.

◆ OnNewLabelCallback

using OnNewLabelCallback = void (*)(Model &, const Label)

Definition at line 32 of file TimelineDecoder.hpp.

◆ OnNewRelationshipCallback

using OnNewRelationshipCallback = void (*)(Model &, const Relationship)

Definition at line 33 of file TimelineDecoder.hpp.

Member Function Documentation

◆ CreateEntity()

TimelineDecoder::TimelineStatus CreateEntity ( const Entity entity)
overridevirtual

Implements ITimelineDecoder.

Definition at line 15 of file TimelineDecoder.cpp.

References ITimelineDecoder::TimelineStatus_Fail, and ITimelineDecoder::TimelineStatus_Success.

16 {
17  if (m_OnNewEntityCallback == nullptr)
18  {
20  }
21  m_OnNewEntityCallback(m_Model, entity);
22 
24 }

◆ CreateEvent()

TimelineDecoder::TimelineStatus CreateEvent ( const Event event)
overridevirtual

Implements ITimelineDecoder.

Definition at line 37 of file TimelineDecoder.cpp.

References ITimelineDecoder::TimelineStatus_Fail, and ITimelineDecoder::TimelineStatus_Success.

38 {
39  if (m_OnNewEventCallback == nullptr)
40  {
42  }
43  m_OnNewEventCallback(m_Model, event);
44 
46 }

◆ CreateEventClass()

TimelineDecoder::TimelineStatus CreateEventClass ( const EventClass eventClass)
overridevirtual

Implements ITimelineDecoder.

Definition at line 26 of file TimelineDecoder.cpp.

References ITimelineDecoder::TimelineStatus_Fail, and ITimelineDecoder::TimelineStatus_Success.

27 {
28  if (m_OnNewEventClassCallback == nullptr)
29  {
31  }
32  m_OnNewEventClassCallback(m_Model, eventClass);
33 
35 }

◆ CreateLabel()

TimelineDecoder::TimelineStatus CreateLabel ( const Label label)
overridevirtual

Implements ITimelineDecoder.

Definition at line 48 of file TimelineDecoder.cpp.

References ITimelineDecoder::TimelineStatus_Fail, and ITimelineDecoder::TimelineStatus_Success.

49 {
50  if (m_OnNewLabelCallback == nullptr)
51  {
53  }
54  m_OnNewLabelCallback(m_Model, label);
55 
57 }

◆ CreateRelationship()

TimelineDecoder::TimelineStatus CreateRelationship ( const Relationship relationship)
overridevirtual

Implements ITimelineDecoder.

Definition at line 59 of file TimelineDecoder.cpp.

References ITimelineDecoder::TimelineStatus_Fail, and ITimelineDecoder::TimelineStatus_Success.

60 {
61  if (m_OnNewRelationshipCallback == nullptr)
62  {
64  }
65  m_OnNewRelationshipCallback(m_Model, relationship);
67 }

◆ GetModel()

const TimelineDecoder::Model & GetModel ( )

Definition at line 69 of file TimelineDecoder.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and CheckTimelinePackets().

70 {
71  return m_Model;
72 }

◆ print()

void print ( )

Definition at line 152 of file TimelineDecoder.cpp.

References armnn::profiling::CentreAlignFormatting(), TimelineDecoder::Model::m_Entities, TimelineDecoder::Model::m_EventClasses, TimelineDecoder::Model::m_Events, TimelineDecoder::Model::m_Labels, and TimelineDecoder::Model::m_Relationships.

Referenced by GatordMockService::WaitForReceivingThread().

153 {
154  if (m_Model.m_Labels.empty() && m_Model.m_Entities.empty() && m_Model.m_EventClasses.empty() &&
155  m_Model.m_Events.empty() && m_Model.m_Relationships.empty())
156  {
157  std::cout << "No timeline packets received" << std::endl;
158  return;
159  }
160 
161  printLabels();
162  printEntities();
163  printEventClasses();
164  printEvents();
165  printRelationships();
166 }

◆ SetDefaultCallbacks()

void SetDefaultCallbacks ( )

Definition at line 124 of file TimelineDecoder.cpp.

References TimelineDecoder::Model::m_Entities, TimelineDecoder::Model::m_EventClasses, TimelineDecoder::Model::m_Events, TimelineDecoder::Model::m_Labels, TimelineDecoder::Model::m_Relationships, TimelineDecoder::SetEntityCallback(), TimelineDecoder::SetEventCallback(), TimelineDecoder::SetEventClassCallback(), TimelineDecoder::SetLabelCallback(), and TimelineDecoder::SetRelationshipCallback().

Referenced by GatordMockService::GatordMockService().

125 {
126  SetEntityCallback([](Model& model, const ITimelineDecoder::Entity entity)
127  {
128  model.m_Entities.emplace_back(entity);
129  });
130 
131  SetEventClassCallback([](Model& model, const ITimelineDecoder::EventClass eventClass)
132  {
133  model.m_EventClasses.emplace_back(eventClass);
134  });
135 
136  SetEventCallback([](Model& model, const ITimelineDecoder::Event event)
137  {
138  model.m_Events.emplace_back(event);
139  });
140 
141  SetLabelCallback([](Model& model, const ITimelineDecoder::Label label)
142  {
143  model.m_Labels.emplace_back(label);
144  });
145 
146  SetRelationshipCallback([](Model& model, const ITimelineDecoder::Relationship relationship)
147  {
148  model.m_Relationships.emplace_back(relationship);
149  });
150 }
TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback)
TimelineStatus SetEventClassCallback(const OnNewEventClassCallback)
TimelineStatus SetLabelCallback(const OnNewLabelCallback)
TimelineStatus SetEntityCallback(const OnNewEntityCallback)
TimelineStatus SetEventCallback(const OnNewEventCallback)

◆ SetEntityCallback()

◆ SetEventCallback()

◆ SetEventClassCallback()

◆ SetLabelCallback()

◆ SetRelationshipCallback()


The documentation for this class was generated from the following files: