Skip to content

Commit

Permalink
SystemFunc.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubpa committed Aug 2, 2020
1 parent 2d9b851 commit 73035e1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
32 changes: 3 additions & 29 deletions include/UECS/SystemFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
34 changes: 34 additions & 0 deletions src/core/SystemFunc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <UECS/SystemFunc.h>

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 }
);
}

0 comments on commit 73035e1

Please sign in to comment.