Skip to content
Snippets Groups Projects
Commit a6a93847 authored by Charles Villard's avatar Charles Villard
Browse files

edit: nodes: update the comments and documentations of new functions and

clean outputName from warnings
parent 4e75e966
No related branches found
No related tags found
1 merge request!371Handle Node connection custom and default names
Pipeline #68492 passed
......@@ -227,26 +227,19 @@ public:
/**
* @brief Name of the input.
* If the input is not linked to any Parent, the value is "".
* @param inID
* @return std::string
*/
std::string inputName(const IOIndex_t inID) const;
/**
* @brief Name of the input.
* If the input is not linked to any Parent, the value is "".
* @brief Update Name of the input.
* @param inID
* @param newName
* @return std::string
*/
std::string inputName(const IOIndex_t inID, std::string newName);
/*
* TODO: ajouter un getter de nom pour le noeud, et ajouter un tableau qui sauvegarde les nom custom
* Si nom custom alors tu le donne, sinon tu donne le nom par defaut en _in _out
*/
/**
* @brief Get the lowest index in the InputData Parent list equal to the
* nullptr.
......@@ -289,9 +282,21 @@ public:
std::vector<std::pair<NodePtr, IOIndex_t>>
output(IOIndex_t outId) const;
/**
* @brief Return the output name of the Node for index.
* @param outId
* @return std::string
*/
std::string outputName(IOIndex_t outId) const;
//TODO: update all input of children nodes
/**
* @brief Update the output name of the Node for index.
* @param outId
* @param newName
* @return std::string
*/
std::string outputName(IOIndex_t outId, std::string newName);
/**
......
......@@ -119,8 +119,8 @@ void init_Node(py::module& m) {
Get ordered list of the current Node's inputs name.
Names can be changed
:return: List of connections. When an input is not linked to any parent, the default value is (None, default_index) TODO
:rtype: list[tuple[Node, int]]
:return: List of connections names. TODO
:rtype: list[str]
)mydelimiter")
.def("input", &Node::input, py::arg("in_id"),
......@@ -135,22 +135,24 @@ void init_Node(py::module& m) {
.def("inputName", py::overload_cast<IOIndex_t>(&Node::inputName, py::const_), py::arg("in_id"),
R"mydelimiter(
Get the parent Node and the associated output index connected to the i-th input of the current Node.
Get the name of the connection of the Node.
:param in_id: input index of the current Node object.
:param in_id: input index of the input Node object.
:type in_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index)
:rtype: tuple[Node, int]
:return: i-th connection name.
:rtype: str
)mydelimiter")
.def("inputName", py::overload_cast<IOIndex_t, std::string>(&Node::inputName), py::arg("in_id"), py::arg("newName"),
R"mydelimiter(
Get the parent Node and the associated output index connected to the i-th input of the current Node.
Update the name of the connection Node.
:param in_id: input index of the current Node object.
:type in_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index)
:rtype: tuple[Node, int]
:param newName: input index of the current Node object.
:type newName: str
:return: i-th connection new name.
:rtype: str
)mydelimiter")
.def("outputs", &Node::outputs,
......@@ -173,32 +175,32 @@ void init_Node(py::module& m) {
.def("outputsNames", &Node::outputsNames,
R"mydelimiter(
Get a list of the children Node for a specific output and the associated input index connected to it.
Get a list of the children Node for the name of its outputs.
:param out_id: input index of the current Node object.
:type out_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index)
:rtype: list[tuple[Node, int]]
:return: i-th connection list name.
:rtype: list[str]
)mydelimiter")
.def("outputName", py::overload_cast<IOIndex_t>(&Node::outputName, py::const_), py::arg("out_id"),
R"mydelimiter(
Get a list of the children Node for a specific output and the associated input index connected to it.
Get the name of an output connection of the Node object.
:param out_id: input index of the current Node object.
:type out_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index)
:rtype: list[tuple[Node, int]]
:return: i-th connection name.
:rtype: str
)mydelimiter")
.def("outputName", py::overload_cast<IOIndex_t, std::string>(&Node::outputName), py::arg("out_id"), py::arg("newName"),
R"mydelimiter(
Get a list of the children Node for a specific output and the associated input index connected to it.
Update the output name of the Node object.
:param out_id: input index of the current Node object.
:type out_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index)
:rtype: list[tuple[Node, int]]
:param newName: new output name
:type newName: str
:return: i-th connection new output name
:rtype: str
)mydelimiter")
.def("get_nb_inputs", &Node::nbInputs,
......
......@@ -233,12 +233,10 @@ std::string Aidge::Node::outputName(Aidge::IOIndex_t outID) const {
}
std::string Aidge::Node::outputName(Aidge::IOIndex_t outID, std::string newName) {
std::vector<std::pair<std::shared_ptr<Node>, IOIndex_t>> listOutputs =
std::vector<std::pair<std::shared_ptr<Node>, IOIndex_t>>();
this->mOutputNames[outID] = newName;
for (std::size_t i = 0; i < mIdInChildren[outID].size(); ++i) {
if (std::shared_ptr<Node> child = mChildren[outID][i].lock()) {
if (child && child->inputName(mIdInChildren[outID][i]) != newName) {
if (child->inputName(mIdInChildren[outID][i]) != newName) {
child->inputName(mIdInChildren[outID][i], newName);
}
}
......
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