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

[Fix] Node name is now updated in GraphViews.

parent 1ffaf28c
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,7 @@ public:
/**
* @brief List outside input connections of the GraphView. The vector
* size is garanteed to match the number of outside inputs of the GraphView. If there is
* size is guaranteed to match the number of outside inputs of the GraphView. If there is
* no external connection to a given input, a pair of nullptr and gk_IODefaultIndex is returned.
* @return std::vector<std::pair<NodePtr, IOIndex_t>>
*/
......@@ -376,6 +376,12 @@ 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);
}
/**
* @brief Include a GraphView content in the current GraphView and link
* the two sets by linking one Node from each GraphView.
......
......@@ -235,8 +235,8 @@ public:
///////////////////////////////////////////////////////
/**
* @brief Vector of pointers to each GraphView containing the object
* @return std::vector<GraphView>
* @brief Set of pointers to each GraphView containing this Node
* @return std::set<GraphView>
*/
inline std::set<std::shared_ptr<GraphView>> views() const noexcept {
std::set<std::shared_ptr<GraphView>> res;
......@@ -460,10 +460,10 @@ private:
// OPERATOR FUNCTIONNAL but commented out to avoid iostream inclusion
// /**
// * @brief operator<< overload to ease print & debug of nodes
// * @param[inout] ostream to print to
// * @param[inout] ostream to print to
// * @param[in] n node to print
// */
// friend std::ostream& operator << (std::ostream& os, Node& n);
// friend std::ostream& operator << (std::ostream& os, Node& n);
};
} // namespace Aidge
......
......@@ -57,7 +57,10 @@ Aidge::Connector Aidge::Node::operator()(const std::vector<Connector>& ctors) {
// INNER
///////////////////////////////////////////////////////
void Aidge::Node::setName(const std::string& name) { mName = name; }
void Aidge::Node::setName(const std::string& name) {
for (auto graphView : views()) graphView->updateNodeName(mName, name);
mName = name;
}
///////////////////////////////////////////////////////
// OPERATORS
......
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