Publishing R3
[platform/upstream/dldt.git] / inference-engine / thirdparty / ade / ade / source / metatypes.cpp
1 // Copyright (C) 2018 Intel Corporation
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5
6 #include <metatypes/metatypes.hpp>
7 #include <sstream>
8
9 namespace ade
10 {
11 namespace meta
12 {
13
14 NodeInfo::NodeInfo(const std::string& kernel,
15                    const std::string& target):
16     kernel_name(kernel),
17     target_name(target)
18 {
19
20 }
21
22 NodeInfo::NodeId NodeInfo::getId() const
23 {
24     return getIdInternal().get();
25 }
26
27 void NodeInfo::link(NodeInfo& node)
28 {
29     m_id = node.getIdInternal();
30 }
31
32 const char* NodeInfo::name()
33 {
34     return "VxNodeInfo";
35 }
36
37 NodeInfo::IdPtr NodeInfo::getIdInternal() const
38 {
39     if (nullptr == m_id)
40     {
41         m_id = std::make_shared<IdStruct>();
42     }
43     return m_id;
44 }
45
46 const char* DataObject::name()
47 {
48     return "DataObject";
49 }
50
51 CommNode::CommNode(int producersCount):
52     m_producersCount(producersCount)
53 {
54     ASSERT(m_producersCount > 0);
55 }
56
57 void CommNode::addDataBuffer(const std::shared_ptr<ade::IDataBuffer>& buff)
58 {
59     ASSERT(buff != nullptr);
60     m_buffers.emplace_back(buff);
61 }
62
63 const char* CommNode::name()
64 {
65     return "CommNode";
66 }
67
68 const char* CommChannel::name()
69 {
70     return "CommChannel";
71 }
72
73 const char* CommConsumerCallback::name()
74 {
75     return "CommConsumerCallback";
76 }
77
78 const char* CommProducerCallback::name()
79 {
80     return "CommProducerCallback";
81 }
82
83 const char* Finalizers::name()
84 {
85     return "Finalizers";
86 }
87
88 std::ostream& operator<<(std::ostream& os, const ade::meta::NodeInfo& obj)
89 {
90     os << obj.kernel_name << " " << obj.target_name;
91     return os;
92 }
93
94 std::ostream& operator<<(std::ostream& os, const ade::meta::CommNode& obj)
95 {
96     os << "producer_count : " << obj.producersCount();
97     return os;
98 }
99
100 std::ostream& operator<<(std::ostream& os, const ade::meta::CommConsumerCallback& /*obj*/)
101 {
102     return os;
103 }
104
105 std::ostream& operator<<(std::ostream& os, const ade::meta::CommProducerCallback& /*obj*/)
106 {
107     return os;
108 }
109
110 std::ostream& operator<<(std::ostream& os, const ade::meta::DataObject& obj)
111 {
112     os << "mem descriptor ref: " << obj.dataRef << ", "
113        << "originalFormat: " << obj.originalFormat;
114     return os;
115 }
116
117 std::ostream& operator<<(std::ostream& os, const ade::meta::CommChannel& obj)
118 {
119     os << obj.channel;
120     return os;
121 }
122
123 std::ostream& operator<<(std::ostream& os, const ade::meta::Finalizers& /*obj*/)
124 {
125     return os;
126 }
127
128 }
129 }