22#include <shared_mutex>
23#include <unordered_map>
28#define N_MAX_COMPONENTS 64
80 std::priority_queue<Address, std::vector<Address>, std::greater<Address>>
_freeAddresses = {};
82 std::unordered_map<ComponentType, std::unordered_map<Address, std::any>>
_componentStorage = {};
119 template <
typename T>
130 template <
typename T>
140 template <
typename T>
151 template <
typename T>
167 template <
typename T>
207 template <
typename... Components>
231#include "Registry.tpp"
Manages entities, their signatures and component type registrations.
void removeComponent(Address address)
Remove a component from an entity.
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
T & getComponent(Address address)
Get a component from an entity.
Address _generateAddress()
std::priority_queue< Address, std::vector< Address >, std::greater< Address > > _freeAddresses
bool hasComponent(Address address)
Check if an entity has a specific component.
std::unordered_map< ComponentType, std::unordered_map< Address, std::any > > _componentStorage
std::vector< Address > view()
Get all entities that have a specific set of components.
Signature getSignature(Address address)
Retrieve the Signature for a given entity address.
~Registry()
Destroy the Registry object and clear internal containers.
void setComponent(Address address, const T &component)
Set/add a component to an entity with its data.
Registry()
Construct a new Registry object.
void addEntityProp(Address address)
Attach a component type T to an entity (set the component bit).
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.