Skip to content
Snippets Groups Projects
Commit a52c1a20 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Merge branch 'fix132' into 'dev'

Fix renaming node with no name

See merge request !150
parents b3d5b86e ee28e275
No related branches found
No related tags found
2 merge requests!212Version 0.3.0,!150Fix renaming node with no name
Pipeline #49970 passed
......@@ -400,10 +400,17 @@ public:
addChild(toOtherNode, mNodeRegistry.at(fromOutNodeName), fromTensor, toTensor);
}
inline void updateNodeName(const std::string& oldName, const std::string& newName){
AIDGE_ASSERT(mNodeRegistry.find(oldName) != mNodeRegistry.end(), "No node named {} in graph {}, the graph may be corrupted !", oldName, name());
mNodeRegistry[newName] = mNodeRegistry[oldName];
mNodeRegistry.erase(oldName);
inline void updateNodeName(NodePtr nodeToRename, const std::string& newName){
const std::string& oldName = nodeToRename->name();
AIDGE_ASSERT(mNodeRegistry.find(newName) != mNodeRegistry.end(), "Name {} is already used in graph {}.", newName, name());
if (nodeToRename->name() != ""){ // Case node already had a name
AIDGE_ASSERT(mNodeRegistry.find(oldName) != mNodeRegistry.end(), "No node named {} in graph {}, the graph may be corrupted !", oldName, name());
mNodeRegistry[newName] = mNodeRegistry[oldName];
mNodeRegistry.erase(oldName);
}else{ // Case node did not had a name
mNodeRegistry[newName] = nodeToRename;
}
}
/**
......
......@@ -64,7 +64,7 @@ Aidge::Connector Aidge::Node::operator()(const std::vector<Connector>& ctors) {
///////////////////////////////////////////////////////
void Aidge::Node::setName(const std::string& name) {
for (auto graphView : views()) graphView->updateNodeName(mName, name);
for (auto graphView : views()) graphView->updateNodeName(shared_from_this(), name);
mName = name;
}
......
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