[coco] Remove FeatureObjectInfo (#1676)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 28 Sep 2018 10:01:44 +0000 (19:01 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 28 Sep 2018 10:01:44 +0000 (19:01 +0900)
Similarly as KernelObjectInfo, FeatureObjectInfo was introduced as a
mean to avoid the use of friend declaration, but this decision is no
longer valid.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/coco/core/include/coco/IR/FeatureObject.h
contrib/coco/core/include/coco/IR/FeatureObjectInfo.forward.h [deleted file]
contrib/coco/core/include/coco/IR/FeatureObjectInfo.h [deleted file]
contrib/coco/core/src/IR/FeatureObject.cpp
contrib/coco/core/src/IR/FeatureObject.test.cpp
contrib/coco/core/src/IR/FeatureObjectInfo.test.cpp [deleted file]
contrib/coco/core/src/IR/ObjectManager.cpp

index fdedad0..23a7434 100644 (file)
@@ -18,7 +18,6 @@
 #define __COCO_IR_FEATURE_OBJECT_H__
 
 #include "coco/IR/Object.h"
-#include "coco/IR/FeatureObjectInfo.h"
 #include "coco/IR/FeatureLayout.h"
 #include "coco/IR/GenericFeatureLayout.h"
 #include "coco/IR/ElemID.h"
@@ -38,7 +37,7 @@ class FeatureObject final : public Object
 {
 public:
   FeatureObject() = default;
-  explicit FeatureObject(std::unique_ptr<FeatureObjectInfo> &&info);
+  explicit FeatureObject(const nncc::core::ADT::feature::Shape &shape);
 
 public:
   ~FeatureObject();
@@ -58,7 +57,6 @@ public:
   void layout(std::unique_ptr<FeatureLayout> &&l) { _layout = std::move(l); }
 
 private:
-  std::unique_ptr<FeatureObjectInfo> _info;
   std::unique_ptr<FeatureLayout> _layout;
 };
 
diff --git a/contrib/coco/core/include/coco/IR/FeatureObjectInfo.forward.h b/contrib/coco/core/include/coco/IR/FeatureObjectInfo.forward.h
deleted file mode 100644 (file)
index c4bc187..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __COCO_IR_FEATURE_OBJECT_INFO_FORWARD_H__
-#define __COCO_IR_FEATURE_OBJECT_INFO_FORWARD_H__
-
-namespace coco
-{
-
-class FeatureObjectInfo;
-
-} // namespace coco
-
-#endif // __COCO_IR_FEATURE_OBJECT_INFO_FORWARD_H__
diff --git a/contrib/coco/core/include/coco/IR/FeatureObjectInfo.h b/contrib/coco/core/include/coco/IR/FeatureObjectInfo.h
deleted file mode 100644 (file)
index fad48bc..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __COCO_IR_FEATURE_OBJECT_INFO_H__
-#define __COCO_IR_FEATURE_OBJECT_INFO_H__
-
-#include <nncc/core/ADT/feature/Shape.h>
-
-namespace coco
-{
-
-class FeatureObjectInfo final
-{
-public:
-  FeatureObjectInfo(const nncc::core::ADT::feature::Shape &shape) : _shape{shape}
-  {
-    // DO NOTHING
-  }
-
-public:
-  const nncc::core::ADT::feature::Shape &shape(void) const { return _shape; }
-
-private:
-  nncc::core::ADT::feature::Shape const _shape;
-};
-
-} // namespace coco
-
-#endif // __COCO_IR_FEATURE_OBJECT_INFO_H__
index 0236eee..550a0a5 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #include "coco/IR/FeatureObject.h"
-#include "coco/IR/FeatureObjectInfo.h"
 
 #include <nncc/core/ADT/feature/CHWLayout.h>
 #include <nncc/foundation/Memory.h>
@@ -27,9 +26,9 @@ using nncc::foundation::make_unique;
 namespace coco
 {
 
-FeatureObject::FeatureObject(std::unique_ptr<FeatureObjectInfo> &&info) : _info(std::move(info))
+FeatureObject::FeatureObject(const nncc::core::ADT::feature::Shape &shape)
 {
-  _layout = make_unique<GenericFeatureLayout>(_info->shape());
+  _layout = make_unique<GenericFeatureLayout>(shape);
 }
 
 FeatureObject::~FeatureObject()
@@ -37,7 +36,7 @@ FeatureObject::~FeatureObject()
   // DO NOTHING
 }
 
-const nncc::core::ADT::feature::Shape &FeatureObject::shape(void) const { return _info->shape(); }
+const nncc::core::ADT::feature::Shape &FeatureObject::shape(void) const { return _layout->shape(); }
 
 ElemID FeatureObject::at(uint32_t ch, uint32_t row, uint32_t col) const
 {
index 26ee175..f5ba997 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #include "coco/IR/FeatureObject.h"
-#include "coco/IR/FeatureObjectInfo.h"
 
 #include <nncc/foundation/Memory.h>
 
@@ -34,8 +33,7 @@ class FeatureObjectTest : public ::testing::Test
 protected:
   coco::FeatureObject *allocate(const feature::Shape &shape)
   {
-    auto info = make_unique<coco::FeatureObjectInfo>(shape);
-    auto o = new coco::FeatureObject{std::move(info)};
+    auto o = new coco::FeatureObject{shape};
     _allocated.emplace_back(o);
     return o;
   }
diff --git a/contrib/coco/core/src/IR/FeatureObjectInfo.test.cpp b/contrib/coco/core/src/IR/FeatureObjectInfo.test.cpp
deleted file mode 100644 (file)
index da54b36..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "coco/IR/FeatureObjectInfo.h"
-
-#include <gtest/gtest.h>
-
-TEST(FeatureObjectInfoTest, constructor)
-{
-  const nncc::core::ADT::feature::Shape shape{1, 3, 3};
-  const coco::FeatureObjectInfo info{shape};
-
-  ASSERT_EQ(info.shape(), shape);
-}
index 6936892..f829475 100644 (file)
@@ -17,7 +17,6 @@
 #include "coco/IR/ObjectManager.h"
 
 #include "coco/IR/FeatureObject.h"
-#include "coco/IR/FeatureObjectInfo.h"
 #include "coco/IR/KernelObject.h"
 
 #include <nncc/foundation/Memory.h>
@@ -36,10 +35,7 @@ template <> FeatureObject *ObjectManager::create(void)
 
 FeatureObject *ObjectManager::create(const nncc::core::ADT::feature::Shape &shape)
 {
-  auto info = make_unique<FeatureObjectInfo>(shape);
-  auto info_ptr = info.get();
-
-  auto feature = make_unique<FeatureObject>(std::move(info));
+  auto feature = make_unique<FeatureObject>(shape);
   auto feature_ptr = feature.get();
 
   modulize(feature_ptr);