From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Mon, 23 Jul 2018 05:33:16 +0000 (+0900) Subject: [coco] Add 'input' method to EntityManager (#762) X-Git-Tag: nncc_backup~2348 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8c9271e0e21a03346b9a3ef669ceba9f73ea2f0;p=platform%2Fcore%2Fml%2Fnnfw.git [coco] Add 'input' method to EntityManager (#762) This commit adds pure virtual 'input' method (which returns a pointer of InputManager) to EntityManager, and updates the corresponding implementation in Module. Signed-off-by: Jonghyun Park --- diff --git a/contrib/coco/core/include/coco/IR/EntityManager.h b/contrib/coco/core/include/coco/IR/EntityManager.h index 82d1417..66ff8c5 100644 --- a/contrib/coco/core/include/coco/IR/EntityManager.h +++ b/contrib/coco/core/include/coco/IR/EntityManager.h @@ -1,6 +1,8 @@ #ifndef __COCO_IR_ENTITY_MANAGER_H__ #define __COCO_IR_ENTITY_MANAGER_H__ +#include "coco/IR/InputManager.h" + namespace coco { @@ -13,6 +15,9 @@ namespace coco struct EntityManager { virtual ~EntityManager() = default; + + virtual InputManager *input(void) = 0; + virtual const InputManager *input(void) const = 0; }; } // namespace coco diff --git a/contrib/coco/core/src/IR/Module.cpp b/contrib/coco/core/src/IR/Module.cpp index 35eb99e..6d21a1e 100644 --- a/contrib/coco/core/src/IR/Module.cpp +++ b/contrib/coco/core/src/IR/Module.cpp @@ -7,7 +7,12 @@ namespace struct EntityManagerImpl final : public coco::EntityManager { - // TO BE FILLED +public: + std::unique_ptr _input; + +public: + coco::InputManager *input(void) override { return _input.get(); } + const coco::InputManager *input(void) const override { return _input.get(); } }; } // namespace @@ -33,8 +38,12 @@ namespace coco std::unique_ptr Module::create(void) { auto m = nncc::foundation::make_unique<::ModuleImpl>(); - - m->_entity = nncc::foundation::make_unique<::EntityManagerImpl>(); + + auto mgr = nncc::foundation::make_unique<::EntityManagerImpl>(); + { + mgr->_input = nncc::foundation::make_unique(); + } + m->_entity = std::move(mgr); return std::move(m); } diff --git a/contrib/coco/core/src/IR/Module.test.cpp b/contrib/coco/core/src/IR/Module.test.cpp index e1edace..c104eca 100644 --- a/contrib/coco/core/src/IR/Module.test.cpp +++ b/contrib/coco/core/src/IR/Module.test.cpp @@ -13,4 +13,7 @@ TEST(IR_MODULE, create) ASSERT_NE(mutable_m->entity(), nullptr); ASSERT_NE(immutable_m->entity(), nullptr); + + ASSERT_NE(mutable_m->entity()->input(), nullptr); + ASSERT_EQ(immutable_m->entity()->input(), mutable_m->entity()->input()); }