From c180dec6e826dcc96ae2d3b056f4b47fd6c9e73b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Fri, 28 Sep 2018 19:01:44 +0900 Subject: [PATCH] [coco] Remove FeatureObjectInfo (#1676) 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 --- contrib/coco/core/include/coco/IR/FeatureObject.h | 4 +-- .../include/coco/IR/FeatureObjectInfo.forward.h | 27 -------------- .../coco/core/include/coco/IR/FeatureObjectInfo.h | 42 ---------------------- contrib/coco/core/src/IR/FeatureObject.cpp | 7 ++-- contrib/coco/core/src/IR/FeatureObject.test.cpp | 4 +-- .../coco/core/src/IR/FeatureObjectInfo.test.cpp | 27 -------------- contrib/coco/core/src/IR/ObjectManager.cpp | 6 +--- 7 files changed, 6 insertions(+), 111 deletions(-) delete mode 100644 contrib/coco/core/include/coco/IR/FeatureObjectInfo.forward.h delete mode 100644 contrib/coco/core/include/coco/IR/FeatureObjectInfo.h delete mode 100644 contrib/coco/core/src/IR/FeatureObjectInfo.test.cpp diff --git a/contrib/coco/core/include/coco/IR/FeatureObject.h b/contrib/coco/core/include/coco/IR/FeatureObject.h index fdedad0..23a7434 100644 --- a/contrib/coco/core/include/coco/IR/FeatureObject.h +++ b/contrib/coco/core/include/coco/IR/FeatureObject.h @@ -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 &&info); + explicit FeatureObject(const nncc::core::ADT::feature::Shape &shape); public: ~FeatureObject(); @@ -58,7 +57,6 @@ public: void layout(std::unique_ptr &&l) { _layout = std::move(l); } private: - std::unique_ptr _info; std::unique_ptr _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 index c4bc187..0000000 --- a/contrib/coco/core/include/coco/IR/FeatureObjectInfo.forward.h +++ /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 index fad48bc..0000000 --- a/contrib/coco/core/include/coco/IR/FeatureObjectInfo.h +++ /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 - -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__ diff --git a/contrib/coco/core/src/IR/FeatureObject.cpp b/contrib/coco/core/src/IR/FeatureObject.cpp index 0236eee..550a0a5 100644 --- a/contrib/coco/core/src/IR/FeatureObject.cpp +++ b/contrib/coco/core/src/IR/FeatureObject.cpp @@ -15,7 +15,6 @@ */ #include "coco/IR/FeatureObject.h" -#include "coco/IR/FeatureObjectInfo.h" #include #include @@ -27,9 +26,9 @@ using nncc::foundation::make_unique; namespace coco { -FeatureObject::FeatureObject(std::unique_ptr &&info) : _info(std::move(info)) +FeatureObject::FeatureObject(const nncc::core::ADT::feature::Shape &shape) { - _layout = make_unique(_info->shape()); + _layout = make_unique(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 { diff --git a/contrib/coco/core/src/IR/FeatureObject.test.cpp b/contrib/coco/core/src/IR/FeatureObject.test.cpp index 26ee175..f5ba997 100644 --- a/contrib/coco/core/src/IR/FeatureObject.test.cpp +++ b/contrib/coco/core/src/IR/FeatureObject.test.cpp @@ -15,7 +15,6 @@ */ #include "coco/IR/FeatureObject.h" -#include "coco/IR/FeatureObjectInfo.h" #include @@ -34,8 +33,7 @@ class FeatureObjectTest : public ::testing::Test protected: coco::FeatureObject *allocate(const feature::Shape &shape) { - auto info = make_unique(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 index da54b36..0000000 --- a/contrib/coco/core/src/IR/FeatureObjectInfo.test.cpp +++ /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 - -TEST(FeatureObjectInfoTest, constructor) -{ - const nncc::core::ADT::feature::Shape shape{1, 3, 3}; - const coco::FeatureObjectInfo info{shape}; - - ASSERT_EQ(info.shape(), shape); -} diff --git a/contrib/coco/core/src/IR/ObjectManager.cpp b/contrib/coco/core/src/IR/ObjectManager.cpp index 6936892..f829475 100644 --- a/contrib/coco/core/src/IR/ObjectManager.cpp +++ b/contrib/coco/core/src/IR/ObjectManager.cpp @@ -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 @@ -36,10 +35,7 @@ template <> FeatureObject *ObjectManager::create(void) FeatureObject *ObjectManager::create(const nncc::core::ADT::feature::Shape &shape) { - auto info = make_unique(shape); - auto info_ptr = info.get(); - - auto feature = make_unique(std::move(info)); + auto feature = make_unique(shape); auto feature_ptr = feature.get(); modulize(feature_ptr); -- 2.7.4