diff --git a/include/aidge/graph/GraphView.hpp b/include/aidge/graph/GraphView.hpp index 52729000ece50aa0c9872ccba1cb078714cc2d98..3311797d858cf4899a6cfed7a18fb9840afb514e 100644 --- a/include/aidge/graph/GraphView.hpp +++ b/include/aidge/graph/GraphView.hpp @@ -96,7 +96,7 @@ public: * specified location. * @param path */ - void save(std::string path, bool verbose = false, bool showProducers = true) const; + void save(const std::string& path, bool verbose = false, bool showProducers = true) const; /** * Check that a node is in the current GraphView. @@ -183,7 +183,7 @@ public: * @brief List all input connections (within and outside) of the specified GraphView node named "name". * @return std::vector<std::pair<NodePtr, IOIndex_t>> */ - std::vector<std::pair<NodePtr, IOIndex_t>> inputs(std::string name) const; + std::vector<std::pair<NodePtr, IOIndex_t>> inputs(const std::string& name) const; /** * @brief List outside output connections of the GraphView. The vector @@ -199,7 +199,7 @@ public: * @return std::vector<std::vector<std::pair<NodePtr, IOIndex_t>>> */ std::vector<std::vector<std::pair<NodePtr, IOIndex_t>>> outputs( - std::string nodeName) const; + const std::string& nodeName) const; /** * @brief Assert Datatype, Backend, data format and dimensions along the GraphView are coherent. @@ -414,7 +414,7 @@ public: */ bool swap(Node &node, Node &otherNode); - void link(std::string name1_inID, std::string name2_outID); + void link(const std::string& name1_inID, const std::string& name2_outID); /** * @brief Insert a node (newParentNode) as a parent of the passed node (childNode). diff --git a/include/aidge/operator/Operator.hpp b/include/aidge/operator/Operator.hpp index 9a32a9b9d16d32a49937804b5c0c596dd05cae1e..a0d2292b7860baa60fe537698784d4d250c81f42 100644 --- a/include/aidge/operator/Operator.hpp +++ b/include/aidge/operator/Operator.hpp @@ -98,10 +98,10 @@ public: virtual void setOutput(const IOIndex_t outputIdx, std::shared_ptr<Data>&& data) = 0; virtual std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const = 0; - std::shared_ptr<Hook> getHook(std::string hookName) { + std::shared_ptr<Hook> getHook(const std::string& hookName) { return mHooks[hookName]; } - void addHook(std::string hookName) { + void addHook(const std::string& hookName) { mHooks.insert(std::pair<std::string, std::shared_ptr<Hook>>(hookName,Registrar<Hook>::create({hookName})(shared_from_this()))); } diff --git a/src/graph/GraphView.cpp b/src/graph/GraphView.cpp index 10d83c6e6ca401d9a9be98dcadb4f41404d1fc5a..3681ac533cab36d68e5243fe0486b7d0febca694 100644 --- a/src/graph/GraphView.cpp +++ b/src/graph/GraphView.cpp @@ -60,7 +60,7 @@ std::string Aidge::GraphView::name() const { return mName; } void Aidge::GraphView::setName(const std::string &name) { mName = name; } -void Aidge::GraphView::save(std::string path, bool verbose, bool showProducers) const { +void Aidge::GraphView::save(const std::string& path, bool verbose, bool showProducers) const { auto fp = std::unique_ptr<FILE, decltype(&std::fclose)>(std::fopen((path + ".mmd").c_str(), "w"), &std::fclose); if (!fp) { @@ -310,7 +310,7 @@ Aidge::GraphView::inputs() const { std::vector<std::pair<std::shared_ptr<Aidge::Node>, Aidge::IOIndex_t>> -Aidge::GraphView::inputs(std::string name) const { +Aidge::GraphView::inputs(const std::string& name) const { return mNodeRegistry.at(name)->inputs(); } @@ -452,7 +452,7 @@ Aidge::GraphView::outputs() const { std::vector< std::vector<std::pair<std::shared_ptr<Aidge::Node>, Aidge::IOIndex_t>>> -Aidge::GraphView::outputs(std::string nodeName) const { +Aidge::GraphView::outputs(const std::string& nodeName) const { return mNodeRegistry.at(nodeName)->outputs(); } @@ -821,8 +821,8 @@ bool Aidge::GraphView::swap(Node & /*node*/, Node & /*otherNode*/) { return false; } -void Aidge::GraphView::link(std::string /*name1_inID*/, - std::string /*name2_outID*/) { +void Aidge::GraphView::link(const std::string& /*name1_inID*/, + const std::string& /*name2_outID*/) { fmt::print("Not implemented yet.\n"); }