[coco] Introduce 'BagType' enum class (#882)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 3 Aug 2018 00:38:51 +0000 (09:38 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 3 Aug 2018 00:38:51 +0000 (09:38 +0900)
This commit introduces 'BagType' enum class, and revises BagInfo to
store its type.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/coco/core/include/coco/IR/BagInfo.h
contrib/coco/core/src/IR/BagInfo.test.cpp [new file with mode: 0644]

index 859eb2d..7f37a13 100644 (file)
@@ -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 (file)
index 0000000..77ffa37
--- /dev/null
@@ -0,0 +1,19 @@
+#include "coco/IR/BagInfo.h"
+
+#include <gtest/gtest.h>
+
+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);
+}