From: 박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Mon, 9 Sep 2019 09:37:11 +0000 (+0900) Subject: [locomotiv] Use const if possible (#7264) X-Git-Tag: accepted/tizen/unified/20190911.111615~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50aaba78e451f585f331cb97b802dc4ec1d58093;p=platform%2Fcore%2Fml%2Fnnfw.git [locomotiv] Use const if possible (#7264) "annot_data" and "annot_domain" do not change the node itself. This commit revies the signature of these helpers to express this property explicitly. Signed-off-by: Jonghyun Park --- diff --git a/compiler/locomotiv/src/NodeDataImpl.cpp b/compiler/locomotiv/src/NodeDataImpl.cpp index 55d7b5a..1111f4c 100644 --- a/compiler/locomotiv/src/NodeDataImpl.cpp +++ b/compiler/locomotiv/src/NodeDataImpl.cpp @@ -43,7 +43,7 @@ void annot_data(loco::Node *node, std::unique_ptr &&data) node->annot(std::unique_ptr(impl)); } -const NodeData *annot_data(loco::Node *node) +const NodeData *annot_data(const loco::Node *node) { auto impl = node->annot(); auto data = dynamic_cast(impl); diff --git a/compiler/locomotiv/src/NodeDataImpl.h b/compiler/locomotiv/src/NodeDataImpl.h index 012a8c8..1c52957 100644 --- a/compiler/locomotiv/src/NodeDataImpl.h +++ b/compiler/locomotiv/src/NodeDataImpl.h @@ -50,7 +50,7 @@ private: void annot_data(loco::Node *node, std::unique_ptr &&data); /// @brief Wrapper to get NodeDataImpl annotation of node -const NodeData *annot_data(loco::Node *node); +const NodeData *annot_data(const loco::Node *node); /// @brief Erase already annotated NodeDataImpl void erase_annot_data(loco::Node *node); diff --git a/compiler/locomotiv/src/NodeDomain.cpp b/compiler/locomotiv/src/NodeDomain.cpp index a1f3a56..709b9fe 100644 --- a/compiler/locomotiv/src/NodeDomain.cpp +++ b/compiler/locomotiv/src/NodeDomain.cpp @@ -39,7 +39,7 @@ void annot_domain(loco::Node *node, const loco::Domain &domain) node->annot(std::move(node_domain)); } -loco::Domain annot_domain(loco::Node *node) +loco::Domain annot_domain(const loco::Node *node) { auto node_domain = node->annot(); if (node_domain) diff --git a/compiler/locomotiv/src/NodeDomain.h b/compiler/locomotiv/src/NodeDomain.h index 6e517a6..fc93f77 100644 --- a/compiler/locomotiv/src/NodeDomain.h +++ b/compiler/locomotiv/src/NodeDomain.h @@ -27,7 +27,7 @@ namespace locomotiv void annot_domain(loco::Node *node, const loco::Domain &domain); /// @brief Wrapper to get domain annotation of node -loco::Domain annot_domain(loco::Node *node); +loco::Domain annot_domain(const loco::Node *node); /// @brief Erase already annotated node domain void erase_annot_domain(loco::Node *node);