|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Dynamic bitset for tracking which components an entity has. More...
#include <ComponentMask.hpp>
Public Member Functions | |
| ComponentMask ()=default | |
| void | set (u32 bit) |
| Sets the given bit. | |
| void | clear (u32 bit) |
| Clears the given bit. | |
| bool | test (u32 bit) const |
| Tests the given bit. | |
| void | reset () |
| Clears all bits. | |
| bool | none () const |
| Returns true if no bits are set. | |
| template<typename Func> | |
| void | forEachSet (Func &&fn) const |
| Iterates all set bits, calling fn(bitIndex) for each. | |
Static Public Attributes | |
| static constexpr u32 | INLINE_WORDS = 2 |
| static constexpr u32 | BITS_PER_WORD = 64 |
| static constexpr u32 | INLINE_BITS = INLINE_WORDS * BITS_PER_WORD |
Dynamic bitset for tracking which components an entity has.
The first 128 bits are stored inline as two u64 words. An overflow vector is allocated only when type IDs exceed 128.
Definition at line 41 of file ComponentMask.hpp.
|
default |
|
inline |
Clears the given bit.
Definition at line 63 of file ComponentMask.hpp.
References BITS_PER_WORD, and INLINE_BITS.
|
inline |
Iterates all set bits, calling fn(bitIndex) for each.
| Func | Callable accepting u32 |
Definition at line 105 of file ComponentMask.hpp.
References BITS_PER_WORD, INLINE_BITS, and INLINE_WORDS.
|
inlinenodiscard |
Returns true if no bits are set.
Definition at line 92 of file ComponentMask.hpp.
|
inline |
Clears all bits.
Definition at line 85 of file ComponentMask.hpp.
|
inline |
Sets the given bit.
Definition at line 50 of file ComponentMask.hpp.
References BITS_PER_WORD, and INLINE_BITS.
|
inlinenodiscard |
Tests the given bit.
Definition at line 75 of file ComponentMask.hpp.
References BITS_PER_WORD, and INLINE_BITS.
|
staticconstexpr |
Definition at line 44 of file ComponentMask.hpp.
Referenced by clear(), forEachSet(), set(), and test().
|
staticconstexpr |
Definition at line 45 of file ComponentMask.hpp.
Referenced by clear(), forEachSet(), set(), and test().
|
staticconstexpr |
Definition at line 43 of file ComponentMask.hpp.
Referenced by forEachSet().