From 73035e1461f82248084ceeee636592cab83022f6 Mon Sep 17 00:00:00 2001 From: Ubpa <641614112@qq.com> Date: Sun, 2 Aug 2020 23:26:28 +0800 Subject: [PATCH] SystemFunc.cpp --- include/UECS/SystemFunc.h | 32 +++----------------------------- src/core/SystemFunc.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 29 deletions(-) create mode 100644 src/core/SystemFunc.cpp diff --git a/include/UECS/SystemFunc.h b/include/UECS/SystemFunc.h index 335fe7c..3968d9b 100644 --- a/include/UECS/SystemFunc.h +++ b/include/UECS/SystemFunc.h @@ -41,35 +41,9 @@ namespace Ubpa::UECS { size_t HashCode() const noexcept { return hashCode; } - void operator()(Entity e, size_t entityIndexInQuery, RTDCmptsView rtdcmpts) { - assert(mode == Mode::Entity); - return func( - e, - entityIndexInQuery, - rtdcmpts, - ChunkView{nullptr, size_t_invalid, nullptr} - ); - } - - void operator()(ChunkView chunkView) { - assert(mode == Mode::Chunk); - return func( - Entity::Invalid(), - size_t_invalid, - RTDCmptsView{nullptr, nullptr}, - chunkView - ); - } - - void operator()() { - assert(mode == Mode::Job); - return func( - Entity::Invalid(), - size_t_invalid, - RTDCmptsView{ nullptr, nullptr }, - ChunkView{nullptr, size_t_invalid, nullptr} - ); - } + void operator()(Entity e, size_t entityIndexInQuery, RTDCmptsView rtdcmpts); + void operator()(ChunkView chunkView); + void operator()(); Mode GetMode() const noexcept { return mode; } diff --git a/src/core/SystemFunc.cpp b/src/core/SystemFunc.cpp new file mode 100644 index 0000000..78973b8 --- /dev/null +++ b/src/core/SystemFunc.cpp @@ -0,0 +1,34 @@ +#include + +using namespace Ubpa::UECS; + +void SystemFunc::operator()(Entity e, size_t entityIndexInQuery, RTDCmptsView rtdcmpts) { + assert(mode == Mode::Entity); + return func( + e, + entityIndexInQuery, + rtdcmpts, + ChunkView{ nullptr, size_t_invalid, nullptr } + ); +} + +void SystemFunc::operator()(ChunkView chunkView) { + assert(mode == Mode::Chunk); + return func( + Entity::Invalid(), + size_t_invalid, + RTDCmptsView{ nullptr, nullptr }, + chunkView + ); +} + +void SystemFunc::operator()() { + assert(mode == Mode::Job); + return func( + Entity::Invalid(), + size_t_invalid, + RTDCmptsView{ nullptr, nullptr }, + ChunkView{ nullptr, size_t_invalid, nullptr } + ); +} +