From 7fbb4f7f18d2a2e28cc1aee9940fda4c895a1581 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: Thu, 13 Sep 2018 12:32:08 +0900 Subject: [PATCH] [coco] Rename DefSlot (#1484) This commit renames DefSlot as Def similarly as Dep/Read/Update for Bag. Signed-off-by: Jonghyun Park --- .../coco/core/include/coco/IR/{DefSlot.h => Def.h} | 12 ++++++------ contrib/coco/core/include/coco/IR/Instr.h | 4 ++-- contrib/coco/core/src/IR/{DefSlot.cpp => Def.cpp} | 4 ++-- .../core/src/IR/{DefSlot.test.cpp => Def.test.cpp} | 19 +++++++++++-------- 4 files changed, 21 insertions(+), 18 deletions(-) rename contrib/coco/core/include/coco/IR/{DefSlot.h => Def.h} (67%) rename contrib/coco/core/src/IR/{DefSlot.cpp => Def.cpp} (87%) rename contrib/coco/core/src/IR/{DefSlot.test.cpp => Def.test.cpp} (75%) diff --git a/contrib/coco/core/include/coco/IR/DefSlot.h b/contrib/coco/core/include/coco/IR/Def.h similarity index 67% rename from contrib/coco/core/include/coco/IR/DefSlot.h rename to contrib/coco/core/include/coco/IR/Def.h index ec0b17b..9421730 100644 --- a/contrib/coco/core/include/coco/IR/DefSlot.h +++ b/contrib/coco/core/include/coco/IR/Def.h @@ -1,5 +1,5 @@ -#ifndef __COCO_IR_DEF_SLOT_H__ -#define __COCO_IR_DEF_SLOT_H__ +#ifndef __COCO_IR_DEF_H__ +#define __COCO_IR_DEF_H__ #include "coco/IR/Object.h" #include "coco/IR/ObjectInfo.forward.h" @@ -9,17 +9,17 @@ namespace coco { -class DefSlot final +class Def final { public: - DefSlot(const PtrLink *link, Object::Producer *producer) + Def(const PtrLink *link, Object::Producer *producer) : _link{link}, _producer{producer} { // DO NOTHING } public: - ~DefSlot() { value(nullptr); } + ~Def() { value(nullptr); } public: Object *value(void) const { return _value; } @@ -37,4 +37,4 @@ private: } // namespace coco -#endif // __COCO_IR_DEF_SLOT_H__ +#endif // __COCO_IR_DEF_H__ diff --git a/contrib/coco/core/include/coco/IR/Instr.h b/contrib/coco/core/include/coco/IR/Instr.h index f11aa30..42ef65a 100644 --- a/contrib/coco/core/include/coco/IR/Instr.h +++ b/contrib/coco/core/include/coco/IR/Instr.h @@ -142,7 +142,7 @@ public: #include "coco/IR/FeatureObject.h" #include "coco/IR/UseSlot.h" -#include "coco/IR/DefSlot.h" +#include "coco/IR/Def.h" /** * @brief Explicit computation step that emits a feature map from another feature map @@ -172,7 +172,7 @@ public: void ifm(FeatureObject *ifm); private: - DefSlot _ofm; + Def _ofm; public: FeatureObject *ofm(void) const; diff --git a/contrib/coco/core/src/IR/DefSlot.cpp b/contrib/coco/core/src/IR/Def.cpp similarity index 87% rename from contrib/coco/core/src/IR/DefSlot.cpp rename to contrib/coco/core/src/IR/Def.cpp index 203d8f4..78cc2c4 100644 --- a/contrib/coco/core/src/IR/DefSlot.cpp +++ b/contrib/coco/core/src/IR/Def.cpp @@ -1,4 +1,4 @@ -#include "coco/IR/DefSlot.h" +#include "coco/IR/Def.h" #include "coco/IR/ObjectInfo.h" #include @@ -6,7 +6,7 @@ namespace coco { -void DefSlot::value(Object *value) +void Def::value(Object *value) { assert(_link != nullptr); diff --git a/contrib/coco/core/src/IR/DefSlot.test.cpp b/contrib/coco/core/src/IR/Def.test.cpp similarity index 75% rename from contrib/coco/core/src/IR/DefSlot.test.cpp rename to contrib/coco/core/src/IR/Def.test.cpp index 47aaf66..ac821ce 100644 --- a/contrib/coco/core/src/IR/DefSlot.test.cpp +++ b/contrib/coco/core/src/IR/Def.test.cpp @@ -1,4 +1,4 @@ -#include "coco/IR/DefSlot.h" +#include "coco/IR/Def.h" #include "coco/IR/ObjectInfo.h" #include "coco/IR/ObjectManager.h" @@ -14,7 +14,7 @@ using nncc::foundation::make_unique; namespace { -class DefSlotTest : public ::testing::Test +class DefTest : public ::testing::Test { protected: coco::PtrLink bag_link; @@ -24,24 +24,26 @@ protected: }; } // namespace -TEST_F(DefSlotTest, constructor) +TEST_F(DefTest, constructor) { auto o = obj_mgr.create(nncc::core::ADT::feature::Shape{1, 1, 1}); ::mock::Def def; - coco::DefSlot slot{&obj_link, &def}; + // TODO Rename 'slot' + coco::Def slot{&obj_link, &def}; ASSERT_EQ(slot.value(), nullptr); } -TEST_F(DefSlotTest, value) +TEST_F(DefTest, value) { auto o = obj_mgr.create(nncc::core::ADT::feature::Shape{1, 1, 1}); ::mock::Def def; - coco::DefSlot slot{&obj_link, &def}; + // TODO Rename 'slot' + coco::Def slot{&obj_link, &def}; slot.value(o); @@ -54,13 +56,14 @@ TEST_F(DefSlotTest, value) ASSERT_EQ(o->def(), nullptr); } -TEST_F(DefSlotTest, unlink_on_destruction) +TEST_F(DefTest, unlink_on_destruction) { auto o = obj_mgr.create(nncc::core::ADT::feature::Shape{1, 1, 1}); ::mock::Def def; - auto slot = make_unique(&obj_link, &def); + // TODO Rename 'slot' + auto slot = make_unique(&obj_link, &def); slot->value(o); ASSERT_EQ(o->def(), &def); -- 2.7.4