[coco] Remove unused onUpdate hook (#1347)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 5 Sep 2018 08:15:00 +0000 (17:15 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 5 Sep 2018 08:15:00 +0000 (17:15 +0900)
* [coco] Remove unused onUpdate hook

This commit removes unused onUpdate hook from Object.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
* Update related comment

contrib/coco/core/include/coco/IR/Object.h
contrib/coco/core/src/IR/Object.cpp
contrib/coco/core/src/IR/Object.test.cpp

index 1ee0b72..2d36d9a 100644 (file)
@@ -42,9 +42,6 @@ protected:
   virtual void get(ObjectInfo **) const = 0;
   virtual void get(const PtrLink<Bag, BagInfo> **) const = 0;
 
-protected:
-  virtual void onUpdate(Bag *) { return; }
-
 private:
   coco::Bag *_bag;
 
index 0582ba0..eba9529 100644 (file)
@@ -32,8 +32,6 @@ void Object::bag(coco::Bag *bag)
   {
     // TODO Update bag-object relation
     _bag = bag;
-    // Notify descendant
-    onUpdate(bag);
 
     auto bag_info = info(_bag);
     assert(bag_info != nullptr);
index 73aefbb..99ba140 100644 (file)
@@ -43,24 +43,6 @@ private:
 } // namespace mock
 } // namespace
 
-namespace
-{
-struct DummyObject : public ::mock::Object
-{
-public:
-  DummyObject(std::vector<coco::Bag *> &updates) : _updates(updates)
-  {
-    // DO NOTHING
-  }
-
-private:
-  void onUpdate(coco::Bag *bag) override { _updates.emplace_back(bag); }
-
-private:
-  std::vector<coco::Bag *> &_updates;
-};
-} // namespace
-
 TEST_F(ObjectTest, ctor)
 {
   ::mock::Object obj;
@@ -80,9 +62,8 @@ TEST_F(ObjectTest, bag_update)
   // Prepare bag
   auto bag = bag_mgr.create(1);
 
-  // Test 'Object' class through 'DummyObject'
-  std::vector<coco::Bag *> updates;
-  DummyObject obj{updates};
+  // Test 'Object' class through a mock-up object
+  ::mock::Object obj;
 
   obj.info = make_unique<coco::ObjectInfo>();
   obj.link = &link;
@@ -92,8 +73,6 @@ TEST_F(ObjectTest, bag_update)
   // 'bag(Bag *)' should affect the return of 'bag(void)'
   ASSERT_EQ(obj.bag(), bag);
 
-  ASSERT_EQ(updates.size(), 1);
-
   // The dependent object list of each bag should be updated on 'bag(...)' call.
   auto bag_info = link.find(bag);