Skip to content
Snippets Groups Projects
Commit d1d973cb authored by Maxence Naud's avatar Maxence Naud
Browse files

Merge branch 'fixNodeSetName' into 'dev'

Fix node set name

See merge request eclipse/aidge/aidge_core!114
parents 1ffaf28c 3d53ab30
No related branches found
No related tags found
No related merge requests found
...@@ -160,7 +160,7 @@ public: ...@@ -160,7 +160,7 @@ public:
/** /**
* @brief List outside input connections of the GraphView. The vector * @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. * no external connection to a given input, a pair of nullptr and gk_IODefaultIndex is returned.
* @return std::vector<std::pair<NodePtr, IOIndex_t>> * @return std::vector<std::pair<NodePtr, IOIndex_t>>
*/ */
...@@ -376,6 +376,12 @@ public: ...@@ -376,6 +376,12 @@ public:
addChild(toOtherNode, mNodeRegistry.at(fromOutNodeName), fromTensor, toTensor); 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 * @brief Include a GraphView content in the current GraphView and link
* the two sets by linking one Node from each GraphView. * the two sets by linking one Node from each GraphView.
......
...@@ -235,8 +235,8 @@ public: ...@@ -235,8 +235,8 @@ public:
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
/** /**
* @brief Vector of pointers to each GraphView containing the object * @brief Set of pointers to each GraphView containing this Node
* @return std::vector<GraphView> * @return std::set<GraphView>
*/ */
inline std::set<std::shared_ptr<GraphView>> views() const noexcept { inline std::set<std::shared_ptr<GraphView>> views() const noexcept {
std::set<std::shared_ptr<GraphView>> res; std::set<std::shared_ptr<GraphView>> res;
...@@ -460,10 +460,10 @@ private: ...@@ -460,10 +460,10 @@ private:
// OPERATOR FUNCTIONNAL but commented out to avoid iostream inclusion // OPERATOR FUNCTIONNAL but commented out to avoid iostream inclusion
// /** // /**
// * @brief operator<< overload to ease print & debug of nodes // * @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 // * @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 } // namespace Aidge
......
...@@ -57,7 +57,10 @@ Aidge::Connector Aidge::Node::operator()(const std::vector<Connector>& ctors) { ...@@ -57,7 +57,10 @@ Aidge::Connector Aidge::Node::operator()(const std::vector<Connector>& ctors) {
// INNER // 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 // 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