diff options
Diffstat (limited to 'runtimes/neurun/src/dumper/dot/DotBuilder.cc')
-rw-r--r-- | runtimes/neurun/src/dumper/dot/DotBuilder.cc | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/runtimes/neurun/src/dumper/dot/DotBuilder.cc b/runtimes/neurun/src/dumper/dot/DotBuilder.cc deleted file mode 100644 index d694323b4..000000000 --- a/runtimes/neurun/src/dumper/dot/DotBuilder.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "DotBuilder.h" - -namespace neurun -{ -namespace dumper -{ -namespace dot -{ - -// NodeAttr -NodeAttr &NodeAttr::addAttr(const std::string &name, const std::string &attr) -{ - _attrs.emplace_back(name, attr); - - return *this; -} - -void NodeAttr::finish() -{ - _attr_stream << "["; - for (auto attr : _attrs) - { - _attr_stream << attr.first << "=" - << "\"" << attr.second << "\" "; - } - _attr_stream << "];\n"; -} - -// DotDumper -DotBuilder::DotBuilder() {} - -void DotBuilder::update(const IDotInfo &node_info) -{ - addNode(node_info); - for (auto child : node_info.children()) - { - addEdge(node_info, *child); - } -} - -void DotBuilder::writeDot(std::ostream &os) -{ - os << "digraph D {\n" - << _dot.str() << "\n" - << "}\n"; -} - -void DotBuilder::addNode(const IDotInfo &dotinfo) -{ - NodeAttr attr; - attr.addAttr("shape", dotinfo.dot_shape()) - .addAttr("label", dotinfo.label()) - .addAttr("style", "filled") - .addAttr("colorscheme", dotinfo.bg_color_scheme()) - .addAttr("fillcolor", dotinfo.bg_color()); - - attr.finish(); - - _dot << dotinfo.index_str() << attr.attr_stream(); -} - -void DotBuilder::addEdge(const IDotInfo &dotinfo1, const IDotInfo &dotinfo2) -{ - _dot << dotinfo1.index_str() << " -> " << dotinfo2.index_str() << ";\n"; -} - -} // namespace dot -} // namespace dumper -} // namespace neurun |