Skip to content
Snippets Groups Projects
Commit c413f115 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Improved display

parent a7e545ce
No related branches found
No related tags found
1 merge request!53GraphView inputs/outputs ordering
Pipeline #35235 passed
......@@ -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&rarr;%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&rarr;%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-->|&rarr;%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&rarr;|output%lu((out#%lu)):::outputCls\n",
namePtrTable[output.first].c_str(), output.second,
outputIdx, outputIdx);
++outputIdx;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment