A storage unit for a page based allocation system.
Despite looking like a std::allocator, you cannot fully implement an allocator using this kind of class alone (as allocators do not have state, and clearly, a page has state). As a result, this class is used by the GeoFixedPoolAllocator class, which is a std::allocator.
This class knows nothing of the types of object that it may be storing, it is just raw memory. Hence no constructors or destructors are called, that is the responsibility of the allocator. |
Name | Description |
---|---|
Geo::s32 TIndexer | The indexing type for the pool. |
Name | Description |
---|---|
Allocate() | Assign a slot in this pool, and return a pointer to it. |
Create(size_t, TIndexer) | Create a pool big enough to hold maxObjects, of size objectSize. |
Deallocate(void *) | Release a single slot back to the pool. |
Destroy() | Free the contents of the pool. |
MaxObjects() | Returns maximum number of objects that can be held. |
public: void * Allocate()
Assign a slot in this pool, and return a pointer to it.
public: bool Create
(
size_t objectSize,
TIndexer maxObjects
)
Create a pool big enough to hold maxObjects, of size objectSize.
public: void Deallocate
(
void * pStorage
)
Release a single slot back to the pool.
public: void Destroy()
Free the contents of the pool.
public: TIndexer MaxObjects() const
Returns maximum number of objects that can be held.