From 3fb32a1a2e079ec7c61d4e5530be7cf94b1dfdb1 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: Thu, 19 Jul 2018 14:42:00 +0900 Subject: [PATCH] [nest] Add 'Ret' class (#717) This commit adds 'Ret' class which records where to return the compute value. Signed-off-by: Jonghyun Park --- contrib/nest/include/nest/Ret.h | 29 +++++++++++++++++++++++++++++ contrib/nest/src/Ret.test.cpp | 21 +++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 contrib/nest/include/nest/Ret.h create mode 100644 contrib/nest/src/Ret.test.cpp diff --git a/contrib/nest/include/nest/Ret.h b/contrib/nest/include/nest/Ret.h new file mode 100644 index 0000000..7abb003 --- /dev/null +++ b/contrib/nest/include/nest/Ret.h @@ -0,0 +1,29 @@ +#ifndef __NEST_RET_H__ +#define __NEST_RET_H__ + +#include "nest/DomainID.h" +#include "nest/Expr.h" + +namespace nest +{ + +class Ret +{ +public: + Ret(const DomainID &id, const expr::Subscript &sub) : _id{id}, _sub{sub} + { + // DO NOTHING + } + +public: + const DomainID &id(void) const { return _id; } + const expr::Subscript &sub(void) const { return _sub; } + +private: + DomainID const _id; + expr::Subscript const _sub; +}; + +} // namespace nest + +#endif // __NEST_RET_H__ diff --git a/contrib/nest/src/Ret.test.cpp b/contrib/nest/src/Ret.test.cpp new file mode 100644 index 0000000..11560e5 --- /dev/null +++ b/contrib/nest/src/Ret.test.cpp @@ -0,0 +1,21 @@ +#include "nest/Ret.h" + +#include + +namespace +{ +struct DummyNode final : public nest::expr::Node +{ +}; +} + +TEST(RET, ctor) +{ + nest::DomainID dom_id{0}; + nest::expr::Subscript sub{std::make_shared()}; + + nest::Ret ret{dom_id, sub}; + + ASSERT_EQ(ret.id().value(), 0); + ASSERT_EQ(ret.sub().rank(), 1); +} -- 2.7.4