From 7b1fcaec90eb198c259af9f7f62dca72ffdf7e17 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: Fri, 3 Aug 2018 09:38:51 +0900 Subject: [PATCH] [coco] Introduce 'BagType' enum class (#882) This commit introduces 'BagType' enum class, and revises BagInfo to store its type. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/BagInfo.h | 14 ++++++++++++++ contrib/coco/core/src/IR/BagInfo.test.cpp | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 contrib/coco/core/src/IR/BagInfo.test.cpp diff --git a/contrib/coco/core/include/coco/IR/BagInfo.h b/contrib/coco/core/include/coco/IR/BagInfo.h index 859eb2d..7f37a13 100644 --- a/contrib/coco/core/include/coco/IR/BagInfo.h +++ b/contrib/coco/core/include/coco/IR/BagInfo.h @@ -8,6 +8,13 @@ namespace coco { +enum class BagType +{ + Intermediate, + Input, + Output +}; + /*** * @brief The internal state of Bag * @@ -34,6 +41,13 @@ public: private: ObjectList _object; + +public: + BagType type(void) const { return _type; } + void type(const BagType &type) { _type = type; } + +private: + BagType _type = BagType::Intermediate; }; } // namespace coco diff --git a/contrib/coco/core/src/IR/BagInfo.test.cpp b/contrib/coco/core/src/IR/BagInfo.test.cpp new file mode 100644 index 0000000..77ffa37 --- /dev/null +++ b/contrib/coco/core/src/IR/BagInfo.test.cpp @@ -0,0 +1,19 @@ +#include "coco/IR/BagInfo.h" + +#include + +TEST(IR_BAG_INFO, constructor) +{ + coco::BagInfo info{16}; + + ASSERT_EQ(info.type(), coco::BagType::Intermediate); +} + +TEST(IR_BAG_INFO, type) +{ + coco::BagInfo info{16}; + + info.type(coco::BagType::Input); + + ASSERT_EQ(info.type(), coco::BagType::Input); +} -- 2.7.4