2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @brief This file contains Node class
20 * @ingroup COM_AI_RUNTIME
24 #ifndef __ONERT_DUMPER_DOT_NODE_H__
25 #define __ONERT_DUMPER_DOT_NODE_H__
30 #include <unordered_map>
52 * @brief Class that represents a Node in "dot" format
58 const static std::string DEFAULT_FILLCOLOR;
59 const static std::string DEFAULT_COLORSCHEME;
60 const static std::string BG_COLORS[8];
64 * @brief Destroy the Node object
67 virtual ~Node() = default;
70 * @brief Construct a new Node object
74 Node(const std::string &id);
81 std::string id() const { return _id; }
84 * @brief return attributes
86 * @return const reference of attributes object
88 const std::unordered_map<std::string, std::string> &attributes() const { return _attributes; }
90 * @brief Store an attribute with key-value pair
92 * @param[in] key attribute's key
93 * @param[in] val attribute's value that is associated with the key
95 void setAttribute(const std::string &key, const std::string &val);
97 * @brief Get the attributte value that is associated with key
99 * @param[in] key key of the attribute
100 * @return value that is associated with the key
102 std::string getAttribute(const std::string &key);
105 * @brief Add an edge in the graph, which is an outgoing edge
107 * @param[in] dotinfo A node that the new edge will be connected to
109 void addOutEdge(Node *dotinfo) { _out_edges.emplace_back(dotinfo); }
111 * @brief Return list of out edges
115 const std::vector<Node *> &out_edges() const { return _out_edges; }
119 std::unordered_map<std::string, std::string> _attributes;
120 std::vector<Node *> _out_edges;
124 } // namespace dumper
127 #endif // __ONERT_DUMPER_DOT_NODE_H__