This commit revises Object::bag method to support Bag unlink.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
{
if (_bag != nullptr)
{
- throw std::runtime_error{"Bag unlink is not supported, yet"};
+ auto bag_info = _link->find(_bag);
+ assert(bag_info != nullptr);
+ assert(bag_info->object()->find(this) != bag_info->object()->end());
+
+ bag_info->object()->erase(this);
+
+ _bag = nullptr;
}
assert(_bag == nullptr);
// User SHOULD be able to access dependent objects through 'bag'
ASSERT_EQ(bag->object()->size(), 1);
ASSERT_EQ(bag->object()->count(&obj), 1);
+
+ // Unlink Object-Bag relation
+ obj.bag(nullptr);
+
+ ASSERT_EQ(obj.bag(), nullptr);
+
+ ASSERT_EQ(bag->object()->size(), 0);
}