ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Node.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
24#ifndef __ONERT_DUMPER_DOT_NODE_H__
25#define __ONERT_DUMPER_DOT_NODE_H__
26
27#include <string>
28#include <memory>
29#include <vector>
30#include <unordered_map>
31
32namespace onert
33{
34namespace dumper
35{
36namespace dot
37{
38
50
55class Node
56{
57public:
58 const static std::string DEFAULT_FILLCOLOR;
59 const static std::string DEFAULT_COLORSCHEME;
60 const static std::string BG_COLORS[8];
61
62public:
67 virtual ~Node() = default;
68
74 Node(const std::string &id);
75
81 std::string id() const { return _id; }
82
88 const std::unordered_map<std::string, std::string> &attributes() const { return _attributes; }
95 void setAttribute(const std::string &key, const std::string &val);
102 std::string getAttribute(const std::string &key);
103
109 void addOutEdge(Node *dotinfo) { _out_edges.emplace_back(dotinfo); }
115 const std::vector<Node *> &out_edges() const { return _out_edges; }
116
117private:
118 std::string _id;
119 std::unordered_map<std::string, std::string> _attributes;
120 std::vector<Node *> _out_edges;
121};
122
123} // namespace dot
124} // namespace dumper
125} // namespace onert
126
127#endif // __ONERT_DUMPER_DOT_NODE_H__
Class that represents a Node in "dot" format.
Definition Node.h:56
const std::vector< Node * > & out_edges() const
Return list of out edges.
Definition Node.h:115
void addOutEdge(Node *dotinfo)
Add an edge in the graph, which is an outgoing edge.
Definition Node.h:109
static const std::string DEFAULT_COLORSCHEME
Definition Node.h:59
void setAttribute(const std::string &key, const std::string &val)
Store an attribute with key-value pair.
Definition Node.cc:39
std::string id() const
return id
Definition Node.h:81
std::string getAttribute(const std::string &key)
Get the attributte value that is associated with key.
Definition Node.cc:41
const std::unordered_map< std::string, std::string > & attributes() const
return attributes
Definition Node.h:88
static const std::string DEFAULT_FILLCOLOR
Definition Node.h:58
static const std::string BG_COLORS[8]
Definition Node.h:60
virtual ~Node()=default
Destroy the Node object.