[coco] Use make_unique without namespace (#1441)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 11 Sep 2018 04:40:32 +0000 (13:40 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 11 Sep 2018 04:40:32 +0000 (13:40 +0900)
This commit introduces 'using' statement for 'make_unique' in
Module.cpp. This change will improve code readability, and make
it easy to adopt C++ 14 later.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/coco/core/src/IR/Module.cpp

index 629d7dd..876d838 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <nncc/foundation/Memory.h>
 
+using nncc::foundation::make_unique;
+
 namespace
 {
 
@@ -107,32 +109,31 @@ namespace coco
 
 std::unique_ptr<Module> Module::create(void)
 {
-  auto bag_link = nncc::foundation::make_unique<coco::PtrLink<Bag, BagInfo>>();
-  auto obj_link = nncc::foundation::make_unique<coco::PtrLink<Object, ObjectInfo>>();
-  auto op_link = nncc::foundation::make_unique<coco::PtrLink<Op, Instr>>();
-  auto ins_link = nncc::foundation::make_unique<coco::PtrLink<Instr, Block>>();
-  auto blk_link = nncc::foundation::make_unique<coco::PtrLink<Block, Module>>();
+  auto bag_link = make_unique<coco::PtrLink<Bag, BagInfo>>();
+  auto obj_link = make_unique<coco::PtrLink<Object, ObjectInfo>>();
+  auto op_link = make_unique<coco::PtrLink<Op, Instr>>();
+  auto ins_link = make_unique<coco::PtrLink<Instr, Block>>();
+  auto blk_link = make_unique<coco::PtrLink<Block, Module>>();
 
-  auto m = nncc::foundation::make_unique<::ModuleImpl>();
+  auto m = make_unique<::ModuleImpl>();
 
-  auto mgr = nncc::foundation::make_unique<::EntityManagerImpl>();
+  auto mgr = make_unique<::EntityManagerImpl>();
   {
-    mgr->_bag = nncc::foundation::make_unique<coco::BagManager>(bag_link.get());
-    mgr->_object =
-        nncc::foundation::make_unique<coco::ObjectManager>(obj_link.get(), bag_link.get());
-    mgr->_op = nncc::foundation::make_unique<coco::OpManager>(op_link.get(), obj_link.get());
-    mgr->_instr = nncc::foundation::make_unique<coco::InstrManager>(op_link.get(), ins_link.get(),
-                                                                    obj_link.get(), bag_link.get());
-    mgr->_block = nncc::foundation::make_unique<coco::BlockManager>(blk_link.get(), ins_link.get());
-    mgr->_input = nncc::foundation::make_unique<coco::InputManager>(bag_link.get());
-    mgr->_output = nncc::foundation::make_unique<coco::OutputManager>(bag_link.get());
+    mgr->_bag = make_unique<coco::BagManager>(bag_link.get());
+    mgr->_object = make_unique<coco::ObjectManager>(obj_link.get(), bag_link.get());
+    mgr->_op = make_unique<coco::OpManager>(op_link.get(), obj_link.get());
+    mgr->_instr = make_unique<coco::InstrManager>(op_link.get(), ins_link.get(), obj_link.get(),
+                                                  bag_link.get());
+    mgr->_block = make_unique<coco::BlockManager>(blk_link.get(), ins_link.get());
+    mgr->_input = make_unique<coco::InputManager>(bag_link.get());
+    mgr->_output = make_unique<coco::OutputManager>(bag_link.get());
   }
   m->_entity = std::move(mgr);
 
   // NOTE BlockManager and BlockList SHOULD share 'blk_link'
-  m->_block = nncc::foundation::make_unique<coco::BlockList>(m.get(), blk_link.get());
-  m->_input = nncc::foundation::make_unique<coco::InputList>();
-  m->_output = nncc::foundation::make_unique<coco::OutputList>();
+  m->_block = make_unique<coco::BlockList>(m.get(), blk_link.get());
+  m->_input = make_unique<coco::InputList>();
+  m->_output = make_unique<coco::OutputList>();
 
   m->_bag_link = std::move(bag_link);
   m->_obj_link = std::move(obj_link);