|
CeresEngine 0.2.0
A game development framework
|
The component store class is responsible for managing and organizing component data storage in memory. More...
#include <CeresEngine/Entity/ComponentStore.hpp>
Public Member Functions | |
| AbstractComponentStore (const size_t chunkSize, const size_t elementSize) | |
| virtual | ~AbstractComponentStore () noexcept |
| Defaulted virtual destructor. | |
| virtual AbstractComponent & | create (EntityIndex entityIndex)=0 |
Creates a new component at entityIndex position. | |
| virtual void | destroy (EntityIndex entityIndex)=0 |
Destroys the component located at entityIndex. | |
| virtual void | copy (EntityIndex sourceEntityIndex, EntityIndex targetEntityIndex)=0 |
Copies the component located at entityIndex | |
| virtual AbstractComponent & | get (EntityIndex entityIndex)=0 |
Gets the component at entityIndex position. | |
| virtual const AbstractComponent & | get (EntityIndex entityIndex) const =0 |
Gets the component at entityIndex position. | |
| size_t | getSize () const noexcept |
| size_t | getCapacity () const noexcept |
| size_t | getChunkSize () const noexcept |
| size_t | getChunkCount () const noexcept |
Protected Member Functions | |
| void * | getRawPointer (const EntityIndex index) noexcept |
Gets a pointer to the the component stored at index. | |
| const void * | getRawPointer (const EntityIndex index) const noexcept |
Gets a pointer to the the component stored at index. | |
| void | ensureMinimumSize (std::size_t size) |
Ensures that the store size is at least size bytes. | |
| void | ensureMinimumCapacity (size_t minCapacity) |
Ensures that the store capacity is at least minCapacity bytes. | |
Protected Attributes | |
| size_t | mSize = 0 |
| The current store size (in bytes) | |
| size_t | mCapacity = 0 |
| The current store capacity (in bytes) | |
| size_t | mChunkSize |
| The size to be used for each memory chunk (in bytes) | |
| size_t | mElementSize |
| The amount of bytes allocated for each element in the store. | |
| Vector< char * > | mChunks |
| A vector of all allocated memory chunks. | |
The component store class is responsible for managing and organizing component data storage in memory.
|
inline |
|
virtualnoexcept |
Defaulted virtual destructor.
|
pure virtual |
Copies the component located at entityIndex
| sourceEntityIndex | The index of the component to copy from |
| targetEntityIndex | The index of the component to copy to |
Implemented in CeresEngine::ComponentStore< C >.
|
pure virtual |
Creates a new component at entityIndex position.
create() on a already created index could lead to a memory leak! The previously constructed component destructor will not be called. The user must manually call `destroy()ยด before calling create on the same index.| entityIndex | The component position |
Implemented in CeresEngine::ComponentStore< C >.
|
pure virtual |
Destroys the component located at entityIndex.
| entityIndex | The index of the component to be destroyed |
Implemented in CeresEngine::ComponentStore< C >.
Ensures that the store capacity is at least minCapacity bytes.
If the store is not large enough, more memory will be allocated.
| minCapacity | The minimum capacity to ensure |
|
protected |
Ensures that the store size is at least size bytes.
If the store is not large enough, the store capacity will be adjusted as needed.
| size | The minimum size to ensure |
|
pure virtual |
Gets the component at entityIndex position.
get() on a not allocated/created position will cause a crash. The user must make sure that the component being retrieved has been previously created with a call to create().| entityIndex | The component position |
Implemented in CeresEngine::ComponentStore< C >.
|
pure virtual |
Gets the component at entityIndex position.
get() on a not allocated/created position will cause a crash. The user must make sure that the component being retrieved has been previously created with a call to create().| entityIndex | The component position |
Implemented in CeresEngine::ComponentStore< C >.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineprotectednoexcept |
Gets a pointer to the the component stored at index.
| index | The component position |
index.
|
inlineprotectednoexcept |
Gets a pointer to the the component stored at index.
| index | The component position |
index.
|
inlinenoexcept |
|
protected |
The current store capacity (in bytes)
A vector of all allocated memory chunks.
|
protected |
The size to be used for each memory chunk (in bytes)
|
protected |
The amount of bytes allocated for each element in the store.
|
protected |
The current store size (in bytes)