Cogs.Core
|
Typed component pool. More...
#include <ComponentPool.h>
Classes | |
struct | ComponentIterator |
Custom iterator providing iteration support for component pools. More... | |
Public Member Functions | |
ComponentPool (Memory::Allocator *allocator, SizeType poolSize, MemBlockType memType=MemBlockType::Bucket) | |
Construct a component pool instance. | |
ComponentPool (SizeType poolSize=16384) | |
Construct a component pool instance. | |
ComponentIterator | begin () |
Returns an iterator to the beginning of the pool. | |
ComponentIterator | end () |
Returns an iterator to the end of the pool. | |
ComponentType & | operator[] (SizeType index) |
Access the component at the given index. | |
![]() | |
COGSFOUNDATION_API | ComponentPoolBase (const Reflection::TypeId typeId, SizeType capacity, Memory::Allocator *allocator, MemBlockType memType) |
Constructs a new pool base for components with the given type. | |
COGSFOUNDATION_API ComponentHandle | allocateComponent () |
Allocates and initializes a new component using placement new into the backing store. | |
COGSFOUNDATION_API void | deallocateComponent (ComponentHandle handle) |
Deallocates a component from the pool, calling the destructor of the derived component type. | |
Component & | operator[] (SizeType index) |
Get the component at the given roster index. | |
Component * | get (size_t index) |
Retrieve a pointer to the component at the given index. The pointer is valid until any new allocations are made. | |
Component * | resolve (const ComponentHandle handle) |
Resolve a pointer to the component with the given handle. | |
COGSFOUNDATION_API void | resize (SizeType capacity) |
Resize the pool. | |
SizeType | size () const |
Gets the current size of the pool, the number components currently active. | |
SizeType | capacity () const |
Get the capacity of the pool, the number of components that can be allocated without resizing the pool. | |
COGSFOUNDATION_API SizeType | maxSize () const |
Get the maximum size of the pool. | |
SizeType | getComponentIndex (const Component *component) const |
Get the index of the given component in the storage pool. | |
void | setFlag (ComponentPoolFlags::EComponentPoolFlags flag) |
Set the given flag. | |
bool | isSet (const uint32_t flag) const |
Checks if the given flag is set. | |
Friends | |
struct | ComponentIterator |
Typed component pool.
Provides typed access to components.
Definition at line 123 of file ComponentPool.h.
|
inline |
Construct a component pool instance.
Definition at line 186 of file ComponentPool.h.
|
inline |
Construct a component pool instance.
Definition at line 194 of file ComponentPool.h.
|
inline |
Returns an iterator to the beginning of the pool.
Definition at line 200 of file ComponentPool.h.
|
inline |
Returns an iterator to the end of the pool.
Definition at line 203 of file ComponentPool.h.
References Cogs::ComponentModel::ComponentPoolBase::size().
|
inline |
Access the component at the given index.
Definition at line 206 of file ComponentPool.h.
References Cogs::ComponentModel::ComponentPoolBase::operator[]().
|
friend |
Definition at line 212 of file ComponentPool.h.