This commit adds 'DomainContext' field and related methods to 'Module'
in order to allow users to build domains through module instance.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
#define __NEST_MODULE_H__
#include "nest/VarContext.h"
+#include "nest/DomainContext.h"
namespace nest
{
public:
VarContext &var(void) { return _var_ctx; }
const VarContext &var(void) const { return _var_ctx; }
+
+private:
+ DomainContext _domain_ctx;
+
+public:
+ DomainContext &domain(void) { return _domain_ctx; }
+ const DomainContext &domain(void) const { return _domain_ctx; }
};
} // namespace nest
create(m);
check(m);
}
+
+TEST(MODULE, create_domain)
+{
+ nest::Module m;
+
+ auto create = [](nest::Module &m, std::initializer_list<uint32_t> dims) {
+ // This code will invoke 'DomainContext &domain(void)' method
+ return m.domain().make(dims);
+ };
+
+ auto check = [](const nest::Module &m) {
+ // This code will invoke 'const DomainContext &domain(void) const' method
+ ASSERT_EQ(m.domain().count(), 1);
+ };
+
+ create(m, {1, 3, 3});
+ check(m);
+}