1#include "ComponentDataPool.h"
8: store(capacity* elementSize, memType),
9 elementSize(elementSize),
17 if (index >= capacity) {
18 const size_t newCapacity = std::min(
static_cast<size_t>(std::numeric_limits<SizeType>::max()),
static_cast<size_t>(std::round(
static_cast<double>(capacity) * 1.55)));
20 store.resize(newCapacity * elementSize);
22 capacity =
static_cast<SizeType>(newCapacity);
26 assert(index < capacity);
COGSFOUNDATION_API void allocate(ComponentHandle handle)
Allocate a new data element in the pool at the index used by the given component handle.
COGSFOUNDATION_API ComponentDataPoolBase(SizeType capacity, size_t elementSize, MemBlockType memType=MemBlockType::Bucket)
Constructs a data pool with the given capacity and element size.
COGSFOUNDATION_API void deallocate(ComponentHandle handle)
Deallocate the data element in the pool at the index used by the given component handle.
uint32_t ComponentIndex
Type used to track component indexes in pools.
ComponentIndex SizeType
Type used to track the size of pools.
Handle to a Component instance.