Shkyera Engine
Easy to use, game engine for Python
Loading...
Searching...
No Matches
shkyera::EntityProvider Class Reference

#include <EntityProvider.hpp>

Public Member Functions

 EntityProvider ()
 
 EntityProvider (const EntityProvider &provider)
 
EntityProvideroperator= (const EntityProvider &other)
 
 ~EntityProvider ()=default
 Default destructor.
 
Entity requestEntity ()
 Request an available entity ID. Returns an entity ID from the pool of available IDs, allocating more if necessary.
 

Private Attributes

std::atomic< Entity_nextEntity
 

Detailed Description

Manages a pool of reusable entity identifiers. Tracks available entity IDs and supports requesting new IDs and returning unused ones for reuse.

Constructor & Destructor Documentation

◆ EntityProvider() [1/2]

shkyera::EntityProvider::EntityProvider ( )

Construct an EntityProvider with a specified number of entities. Initializes the pool of entity IDs (from 0 to numEntities - 1) and stores them in the queue for reuse.

◆ EntityProvider() [2/2]

shkyera::EntityProvider::EntityProvider ( const EntityProvider provider)

◆ ~EntityProvider()

shkyera::EntityProvider::~EntityProvider ( )
default

Default destructor.

Member Function Documentation

◆ operator=()

EntityProvider & shkyera::EntityProvider::operator= ( const EntityProvider other)

◆ requestEntity()

Entity shkyera::EntityProvider::requestEntity ( )

Request an available entity ID. Returns an entity ID from the pool of available IDs, allocating more if necessary.

Returns
An unused entity ID.

Member Data Documentation

◆ _nextEntity

std::atomic<Entity> shkyera::EntityProvider::_nextEntity
private

Tracks the total number of entity IDs allocated so far.


The documentation for this class was generated from the following files: