Commit graph

105 commits

Author SHA1 Message Date
4752a67380 Merge branch 'master' into cxx17 2021-09-08 10:49:49 +09:00
c2dc5124c9 Rename a UnitTest for ThreadPool 2021-09-08 10:49:32 +09:00
eca91d3670 Merge branch 'master' into cxx17 2021-09-08 10:46:39 +09:00
64e9b18f89 Fix UnitTests for ThreadPool 2021-09-08 10:46:26 +09:00
5baa4e92b7 Merge branch 'master' into cxx17 2021-09-07 20:25:10 +09:00
222fbb0862 Make ThreadPool::getThreadCount() constexpr 2021-09-07 20:24:47 +09:00
4fd463a870 Add tests for ThreadPool::getThreadCount() 2021-09-07 20:21:20 +09:00
5c72ecb74b Add ThreadPool::getThreadCount()
Without the previously removed THREADCOUNT constant, there was no way to
query the ThreadCount from outside the class. This function provides
this.
2021-09-07 20:18:41 +09:00
39500e1fdc Merge branch 'master' into cxx17 2021-09-07 20:16:36 +09:00
beb3eae6e2 Remove "THREADCOUNT" from ThreadPool
Redundant because "SIZE" provides the same value.
2021-09-07 20:15:53 +09:00
12ea26a69a Merge branch 'master' into cxx17 2021-09-07 18:29:17 +09:00
e8f5e57772 Add missing include for "array" 2021-09-07 18:28:44 +09:00
155df42657 Merge branch 'master' into cxx17 2021-09-07 18:16:29 +09:00
a851c63619 Workaround for gcc debug build fail
Instead of defining temporary structs in functions, the temporary
structs are defined as part of the Manager class.
2021-09-07 18:11:06 +09:00
be43cd03c5 Heavy refactorings
Use temporary structs instead of tuples.
Enforce max line width of 80 characters.
Fix warning related to ECTest.cpp .

Note that currently this commit appears to be unable to be built by GCC,
but compiles OK with Clang.
2021-09-07 17:04:20 +09:00
bfd5dba0b2 Merge branch 'master' into cxx17 2021-09-07 12:24:48 +09:00
dc7c29f7cc Fix failing to wait for ThreadPool to finish 2021-09-07 12:24:27 +09:00
481f223c7d Add "if constexpr" where possible in Manager 2021-09-07 12:13:28 +09:00
20df53837b Use "if constexpr" in ThreadPool 2021-09-07 12:11:36 +09:00
eb638f325e Merge branch 'master' into cxx17 2021-09-07 12:10:07 +09:00
d32c6d8d40 Fix CMakeLists.txt to use FindThreads 2021-09-07 12:09:02 +09:00
183eab10b3 Update documentation 2021-09-07 12:04:42 +09:00
6a8902ad51 Allow ThreadPool to be created with < 2 ThreadCount 2021-09-07 11:46:38 +09:00
16f410c8ef Add isQueueEmpty() to ThreadPool 2021-09-07 11:29:06 +09:00
13152d1c22 Tweak sleep times for threadpool to finish
Remove debug print
2021-09-06 21:01:01 +09:00
0f2a98b886 Usage of ThreadPool fixes 2021-09-06 20:57:13 +09:00
f44d2f8c7b WIP convert Manager to use ThreadPool
valgrind seems to report memory issues, and documentation may need more
updating.
2021-09-06 19:52:23 +09:00
2e9e18a964 Impl ThreadPool 2021-09-06 15:54:24 +09:00
95697ae7b6 Merge branch 'master' into cxx17 2021-05-17 12:34:26 +09:00
381e069ec2 Add UnitTest for previously fixed bug 2021-05-17 12:34:12 +09:00
f6dbe5414e Merge branch 'master' into cxx17 2021-05-16 20:08:25 +09:00
e0f30db951 Fix bug using callForMatchingFunction(s)
Fixed bug where invalid entity ids were used when using the
callForMatchingFunction(s) functions.
2021-05-16 20:07:14 +09:00
25c864dd8a Merge branch 'master' into cxx17 2019-11-06 16:37:46 +09:00
a310a8ae38 Add forMatchingSimple, refactorings 2019-11-06 16:33:12 +09:00
e0da16a63e Replace vector with deque for Component storage
When reallocating more data, vector moves the original data to a new
buffer. Deque preserves the location of the original data, preventing
invalidated pointers to existing data when additional allocation is
required.
2019-11-06 15:47:16 +09:00
4db5e0caed Add fn to Manager allowing iterable indices as sig
As an alternative to forMatchingSignatures, which calls the given
function on entities matching the given Components/Tags in the
signature, forMatchingIterable allows filtering entities by an iterable
of indices that corresponds to Components/Tags.
2019-07-11 21:11:03 +09:00
50a84f5c8c Minor whitespace fixes, minor .gitignore change 2019-07-11 19:47:39 +09:00
f59f78385d Use "if constexpr" provided by C++17 2018-11-22 14:32:32 +09:00
8f133acbc6 Fix stored functions not being called in order
Manager::callForMatchingFunctions should now call all functions in the
order they were added.
2018-11-22 14:31:55 +09:00
8c462b83a1 Add static_assert, components must be def-const
EC::Manager will fail to compile if any given Component is not default
constructible, so a static_assert and ctest was added.
2018-09-11 12:16:04 +09:00
6bf239a43b API change: context/userdata provided to functions
All functions called by EC/Manager now accept an additional parameter
as a void* to support user-provided data (or context) for functions
(useful when the function is not a lambda function and doesn't have any
other data stored with it).
2018-08-08 16:52:12 +09:00
2411125003 Fix C++14 requirement in CMakeLists.txt 2018-05-21 19:24:49 +09:00
b9589b909d Minor fixes/improvements 2018-05-19 16:09:31 +09:00
9d914ce10d Update documentation 2018-05-18 20:47:34 +09:00
d12af4d527 Add ability to handle unknown types
EC/Manager and EC/Bitset can now handle types that are not known
(Components or Tags not in the given Components or Tags when created).

Manager::getEntityData now returns a pointer instead of a reference.
Functions passed to Manager::forMatchingFunction (and other similar fns)
should now accept Component fields as pointer types, not reference
types.
2018-05-17 17:05:49 +09:00
1e1344cdae Fix warning about unused capture for lambda fn 2018-05-16 16:18:11 +09:00
3b742735f0 Add type reference to Components/Tags in Manager 2018-05-16 14:48:33 +09:00
6f0b7cb65b Fix bug with multiple sig/func call
Fixed bug where if an entity is deleted during a multiple
signature/function call but matched a later signature/function, it would
still be called in that later function.

Minor fixes as well.
2017-12-01 19:20:59 +09:00
6124a45453 Replace garbage-collection-like cleanup
Entity IDs are now guaranteed to not change for a living entity.
Cleanup is replaced by using a std::unordered_set to store deleted
Entity IDs to be reclaimed on later calls to addEntity().
2017-12-01 14:00:49 +09:00
477580ad34 Minor fixes to documentation 2017-11-24 15:06:57 +09:00