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: ...@@ -227,26 +227,19 @@ public:
/** /**
* @brief Name of the input. * @brief Name of the input.
* If the input is not linked to any Parent, the value is "".
* @param inID * @param inID
* @return std::string * @return std::string
*/ */
std::string inputName(const IOIndex_t inID) const; std::string inputName(const IOIndex_t inID) const;
/** /**
* @brief Name of the input. * @brief Update Name of the input.
* If the input is not linked to any Parent, the value is "".
* @param inID * @param inID
* @param newName
* @return std::string * @return std::string
*/ */
std::string inputName(const IOIndex_t inID, std::string newName); 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 * @brief Get the lowest index in the InputData Parent list equal to the
* nullptr. * nullptr.
...@@ -289,9 +282,21 @@ public: ...@@ -289,9 +282,21 @@ public:
std::vector<std::pair<NodePtr, IOIndex_t>> std::vector<std::pair<NodePtr, IOIndex_t>>
output(IOIndex_t outId) const; 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; 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); std::string outputName(IOIndex_t outId, std::string newName);
/** /**
......
...@@ -119,8 +119,8 @@ void init_Node(py::module& m) { ...@@ -119,8 +119,8 @@ void init_Node(py::module& m) {
Get ordered list of the current Node's inputs name. Get ordered list of the current Node's inputs name.
Names can be changed 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 :return: List of connections names. TODO
:rtype: list[tuple[Node, int]] :rtype: list[str]
)mydelimiter") )mydelimiter")
.def("input", &Node::input, py::arg("in_id"), .def("input", &Node::input, py::arg("in_id"),
...@@ -135,22 +135,24 @@ void init_Node(py::module& m) { ...@@ -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"), .def("inputName", py::overload_cast<IOIndex_t>(&Node::inputName, py::const_), py::arg("in_id"),
R"mydelimiter( 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 :type in_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index) :return: i-th connection name.
:rtype: tuple[Node, int] :rtype: str
)mydelimiter") )mydelimiter")
.def("inputName", py::overload_cast<IOIndex_t, std::string>(&Node::inputName), py::arg("in_id"), py::arg("newName"), .def("inputName", py::overload_cast<IOIndex_t, std::string>(&Node::inputName), py::arg("in_id"), py::arg("newName"),
R"mydelimiter( 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. :param in_id: input index of the current Node object.
:type in_id: int :type in_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index) :param newName: input index of the current Node object.
:rtype: tuple[Node, int] :type newName: str
:return: i-th connection new name.
:rtype: str
)mydelimiter") )mydelimiter")
.def("outputs", &Node::outputs, .def("outputs", &Node::outputs,
...@@ -173,32 +175,32 @@ void init_Node(py::module& m) { ...@@ -173,32 +175,32 @@ void init_Node(py::module& m) {
.def("outputsNames", &Node::outputsNames, .def("outputsNames", &Node::outputsNames,
R"mydelimiter( 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. :return: i-th connection list name.
:type out_id: int :rtype: list[str]
: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]]
)mydelimiter") )mydelimiter")
.def("outputName", py::overload_cast<IOIndex_t>(&Node::outputName, py::const_), py::arg("out_id"), .def("outputName", py::overload_cast<IOIndex_t>(&Node::outputName, py::const_), py::arg("out_id"),
R"mydelimiter( 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. :param out_id: input index of the current Node object.
:type out_id: int :type out_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index) :return: i-th connection name.
:rtype: list[tuple[Node, int]] :rtype: str
)mydelimiter") )mydelimiter")
.def("outputName", py::overload_cast<IOIndex_t, std::string>(&Node::outputName), py::arg("out_id"), py::arg("newName"), .def("outputName", py::overload_cast<IOIndex_t, std::string>(&Node::outputName), py::arg("out_id"), py::arg("newName"),
R"mydelimiter( 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. :param out_id: input index of the current Node object.
:type out_id: int :type out_id: int
:return: i-th connection. When an input is not linked to any parent, the default value is (None, default_index) :param newName: new output name
:rtype: list[tuple[Node, int]] :type newName: str
:return: i-th connection new output name
:rtype: str
)mydelimiter") )mydelimiter")
.def("get_nb_inputs", &Node::nbInputs, .def("get_nb_inputs", &Node::nbInputs,
......
...@@ -233,12 +233,10 @@ std::string Aidge::Node::outputName(Aidge::IOIndex_t outID) const { ...@@ -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::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; this->mOutputNames[outID] = newName;
for (std::size_t i = 0; i < mIdInChildren[outID].size(); ++i) { for (std::size_t i = 0; i < mIdInChildren[outID].size(); ++i) {
if (std::shared_ptr<Node> child = mChildren[outID][i].lock()) { 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); 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