![]() |
ezEngine Release 26.3
|
High-performance container for objects with pluggable storage strategies. More...
#include <BlockStorage.h>
Classes | |
| class | ConstIterator |
| class | Iterator |
Public Member Functions | |
| ezBlockStorage (ezLargeBlockAllocator< BlockSizeInByte > *pBlockAllocator, ezAllocator *pAllocator) | |
| void | Clear () |
| Removes all objects and deallocates all blocks. | |
| T * | Create () |
| Creates a new object and returns a pointer to it. | |
| void | Delete (T *pObject) |
| Deletes the specified object. | |
| void | Delete (T *pObject, T *&out_pMovedObject) |
| Deletes the specified object and reports any moved object. | |
| ezUInt32 | GetCount () const |
| Returns the total number of objects currently stored. | |
| Iterator | GetIterator (ezUInt32 uiStartIndex=0, ezUInt32 uiCount=ezInvalidIndex) |
| Returns an iterator for traversing objects in a specified range. | |
| ConstIterator | GetIterator (ezUInt32 uiStartIndex=0, ezUInt32 uiCount=ezInvalidIndex) const |
| Returns a const iterator for traversing objects in a specified range. | |
High-performance container for objects with pluggable storage strategies.
This container manages objects in blocks of memory, using different strategies for handling gaps when objects are removed. It's designed for scenarios where you need fast allocation and deallocation of many objects, with the choice between compact memory layout or stable object addressing.
Storage strategies:
| T * ezBlockStorage< T, BlockSize, StorageType >::Create | ( | ) |
Creates a new object and returns a pointer to it.
The object is default-constructed. Returns nullptr if allocation fails.
| void ezBlockStorage< T, BlockSize, StorageType >::Delete | ( | T * | pObject, |
| T *& | out_pMovedObject | ||
| ) |
Deletes the specified object and reports any moved object.
For Compact storage, if another object is moved to fill the gap, out_pMovedObject will point to the moved object's new location. For FreeList storage, out_pMovedObject is always set to nullptr.