From c413f11570e5ccfb3563a19ba7c139cd0e848ce0 Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Sun, 3 Dec 2023 13:13:48 +0100 Subject: [PATCH] Improved display --- src/graph/GraphView.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/graph/GraphView.cpp b/src/graph/GraphView.cpp index 3b1a366f5..0b64c518c 100644 --- a/src/graph/GraphView.cpp +++ b/src/graph/GraphView.cpp @@ -71,10 +71,10 @@ void Aidge::GraphView::save(std::string path, bool verbose) const { typeCounter[currentType] = 0; ++typeCounter[currentType]; - const std::string givenName = + std::string givenName = (node_ptr->name().empty()) - ? currentType + std::to_string(typeCounter[currentType]) - : node_ptr->name(); + ? "<em>" + currentType + "#" + std::to_string(typeCounter[currentType]) + "</em>" + : node_ptr->name() + " <sub><em>" + currentType + "</em></sub>"; namePtrTable[node_ptr] = (currentType + "_" + std::to_string(typeCounter[currentType])); @@ -87,6 +87,7 @@ void Aidge::GraphView::save(std::string path, bool verbose) const { givenName.c_str()); } } + // Write every link for (const std::shared_ptr<Node> &node_ptr : mNodes) { IOIndex_t outputIdx = 0; @@ -97,11 +98,11 @@ void Aidge::GraphView::save(std::string path, bool verbose) const { for (auto parent : child->inputs()) { if (parent.first == node_ptr && parent.second == outputIdx) { if (mNodes.find(child) != mNodes.end()) { - std::fprintf(fp, "%s-->|%u..%u|%s\n", namePtrTable[node_ptr].c_str(), + std::fprintf(fp, "%s-->|%u→%u|%s\n", namePtrTable[node_ptr].c_str(), outputIdx, inputIdx, namePtrTable[child].c_str()); } else if (verbose) { - std::fprintf(fp, "%s-->|%u..%u|%p:::externalCls\n", namePtrTable[node_ptr].c_str(), + std::fprintf(fp, "%s-->|%u→%u|%p:::externalCls\n", namePtrTable[node_ptr].c_str(), outputIdx, inputIdx, static_cast<void*>(child.get())); } break; @@ -116,14 +117,14 @@ void Aidge::GraphView::save(std::string path, bool verbose) const { size_t inputIdx = 0; for (auto input : mInputNodes) { - std::fprintf(fp, "input%lu((in#%lu)):::inputCls-->|..%u|%s\n", inputIdx, inputIdx, + std::fprintf(fp, "input%lu((in#%lu)):::inputCls-->|→%u|%s\n", inputIdx, inputIdx, input.second, namePtrTable[input.first].c_str()); ++inputIdx; } size_t outputIdx = 0; for (auto output : mOutputNodes) { - std::fprintf(fp, "%s-->|%u..|output%lu((out#%lu)):::outputCls\n", + std::fprintf(fp, "%s-->|%u→|output%lu((out#%lu)):::outputCls\n", namePtrTable[output.first].c_str(), output.second, outputIdx, outputIdx); ++outputIdx; -- GitLab