41 sign.set(componentType);
48 std::unique_lock lock(
_mutex);
57 std::unique_lock lock(
_mutex);
71 std::shared_lock lock(
_mutex);
80 std::shared_lock lock(
_mutex);
81 std::vector<Address> result;
83 if (requiredMask == 0) {
87 for (
const auto &[address, signature] :
_signatures) {
88 if ((signature & requiredMask) == requiredMask) {
89 result.push_back(address);
Registry for the ECS (Entity-Component System).
void destroyEntity(Address address)
Remove an entity and its Signature from the registry.
std::vector< Address > getEntitiesWithMask(Signature requiredMask)
Get all entities matching a specific component mask.
Signature _registerComponent(ComponentType componentType)
Address newEntity()
Create and register a new entity, returning its Address.
std::unordered_map< Address, Signature > _signatures
std::unordered_map< ComponentType, Signature > _componentMap
Address _generateAddress()
std::priority_queue< Address, std::vector< Address >, std::greater< Address > > _freeAddresses
std::unordered_map< ComponentType, std::unordered_map< Address, std::any > > _componentStorage
Signature getSignature(Address address)
Retrieve the Signature for a given entity address.
~Registry()
Destroy the Registry object and clear internal containers.
Registry()
Construct a new Registry object.
Maximum number of distinct component types supported by the Registry.
std::size_t ComponentType
Type alias for component identification.
std::uint32_t Address
Type used to represent an entity address/ID.
std::bitset< N_MAX_COMPONENTS > Signature
Bitset representing the set of components attached to an entity.