NcEngine
|
Storage class for tracking active entities. More...
#include <EntityPool.h>
Public Types | |
using | value_type = Entity |
using | iterator = std::vector< Entity >::iterator |
using | const_iterator = std::vector< Entity >::const_iterator |
using | reverse_iterator = std::vector< Entity >::reverse_iterator |
Public Member Functions | |
EntityPool (size_t maxEntities) | |
auto | Add (Entity::layer_type layer, Entity::flags_type flags, Entity::user_data_type userData) -> Entity |
Add an entity. | |
void | Remove (Entity entity) |
Remove an entity. | |
bool | Contains (Entity entity) const |
Check if an entity exists. | |
auto | Size () const noexcept -> size_t |
Get the number of entities in the pool. | |
auto | RecycleDeadEntities () -> std::vector< Entity > |
Add removed entity indices back to the pool of possible indices. | |
void | Clear () |
Remove all entities. | |
void | ClearNonPersistent () |
Remove all entities, excluding those with the persistent flag. | |
auto | begin () noexcept |
Get an iterator to the first entity in the pool. | |
auto | begin () const noexcept |
Get a const_iterator to the first entity in the pool. | |
auto | end () noexcept |
Get an iterator one past the last entity in the pool. | |
auto | end () const noexcept |
Get a const_iterator one past the last entity in the pool. | |
auto | size () const noexcept |
Get the number of entities in the pool. | |
auto | empty () const noexcept |
Check if there are no entities in the pool. | |
auto | operator[] (size_t pos) noexcept -> Entity & |
Get a reference to the entity at the specified position. | |
auto | operator[] (size_t pos) const noexcept -> const Entity & |
Get a const reference to the entity at the specified position. | |
auto | at (size_t pos) -> Entity & |
Get a reference to the entity at the specified position with bounds checking. | |
auto | at (size_t pos) const -> const Entity & |
Get a const reference to the entity at the specified position with bounds checking. | |
auto | data () noexcept |
Get a pointer to the underlying entity array. | |
auto | data () const noexcept |
Get a pointer to the underlying entity array. | |
![]() | |
StableAddress (const StableAddress &)=delete | |
StableAddress (StableAddress &&)=delete | |
StableAddress & | operator= (const StableAddress &)=delete |
StableAddress & | operator= (StableAddress &&)=delete |
Storage class for tracking active entities.