Relocate badState helper to the top of ModelBuilder (#935)
author김수진/동작제어Lab(SR)/Engineer/삼성전자 <sjsujin.kim@samsung.com>
Fri, 27 Apr 2018 06:09:14 +0000 (15:09 +0900)
committer최형규/동작제어Lab(SR)/Senior Engineer/삼성전자 <hk0110.choi@samsung.com>
Fri, 27 Apr 2018 06:09:14 +0000 (15:09 +0900)
As we've discussed in https://github.sec.samsung.net/STAR/nnfw/pull/809#discussion_r48662, once this helper was merged for easy to review, and then we've planed rearrange the order to easy to read in another PR.
This is why I make this PR.

Signed-off-by: sjsujinkim <sjsujin.kim@samsung.com>
src/runtime/ref/nn/runtime/ModelBuilder.cpp

index 77791f8..fc5f760 100644 (file)
@@ -27,6 +27,18 @@ namespace nn {
 const uint32_t MAX_NUMBER_OF_OPERANDS = 0xFFFFFFFE;
 const uint32_t MAX_NUMBER_OF_OPERATIONS = 0xFFFFFFFE;
 
+bool ModelBuilder::badState(const char* name) {
+    if (mCompletedModel) {
+        LOG(ERROR) << "ANeuralNetworksModel_" << name << " can't modify after model finished";
+        return true;
+    }
+    if (mInvalidModel) {
+        LOG(ERROR) << "ANeuralNetworksModel_" << name << " can't modify an invalid model";
+        return true;
+    }
+    return false;
+}
+
 int ModelBuilder::addOperand(const ANeuralNetworksOperandType& type) {
     if (badState("addOperand")) {
         return ANEURALNETWORKS_BAD_STATE;
@@ -370,17 +382,5 @@ void ModelBuilder::setHidlModel(Model* model) const {
     }
 }
 
-bool ModelBuilder::badState(const char* name) {
-    if (mCompletedModel) {
-        LOG(ERROR) << "ANeuralNetworksModel_" << name << " can't modify after model finished";
-        return true;
-    }
-    if (mInvalidModel) {
-        LOG(ERROR) << "ANeuralNetworksModel_" << name << " can't modify an invalid model";
-        return true;
-    }
-    return false;
-}
-
 }  // namespace nn
 }  // namespace android