|
Nebula
|
#include <idallocator.h>
Inherits Util::ArrayAllocatorSafe< MAX_ALLOCS, TYPES... >.
Public Member Functions | |
| IdAllocatorSafe () | |
| constructor | |
| Ids::Id32 | Alloc () |
| Allocate an object. | |
| void | Dealloc (Ids::Id32 index) |
| Deallocate an object. Just places it in freeids array for recycling. | |
| Public Member Functions inherited from Util::ArrayAllocatorSafe< MAX_ALLOCS, TYPES... > | |
| ArrayAllocatorSafe () | |
| constructor | |
| ~ArrayAllocatorSafe () | |
| destructor | |
| void | operator= (const ArrayAllocatorSafe< MAX_ALLOCS, TYPES... > &rhs) |
| assign operator | |
| uint32_t | Alloc () |
| allocate a new resource | |
| void | EraseIndex (const uint32_t id) |
| Erase element for each. | |
| void | EraseIndexSwap (const uint32_t id) |
| Erase element for each. | |
| tuple_array_t< MEMBER, TYPES... > & | Get (const uint32_t index) |
| get single item from resource | |
| const tuple_array_t< MEMBER, TYPES... > & | ConstGet (const uint32_t index) const |
| Get const explicitly. | |
| void | Set (const uint32_t index, const tuple_array_t< MEMBER, TYPES... > &type) |
| set single item | |
| const Util::Array< tuple_array_t< MEMBER, TYPES... > > & | GetArray () const |
| get array const reference | |
| const uint32_t | Size () const |
| get number of used indices | |
| void | Reserve (uint32_t size) |
| grow capacity of arrays to size | |
| void | Clear () |
| clear entire allocator and start from scratch. | |
| void | UpdateSize () |
| Any reserve and direct array access might mess with the size. | |
| void | TryAcquire (const uint32_t index) |
| Spinlock to acquire. | |
| bool | Acquire (const uint32_t index) |
| Acquire element, asserts if false and returns true if this call acquired. | |
| void | Release (const uint32_t index) |
| Release an object, the next thread that acquires may use this instance as it fits. | |
Private Attributes | |
| Util::Array< Ids::Id32 > | freeIds |
| Util::Array< Ids::Id8 > | generations |
Additional Inherited Members | |
| Protected Attributes inherited from Util::ArrayAllocatorSafe< MAX_ALLOCS, TYPES... > | |
| uint32_t | size |
| std::tuple< Util::PinnedArray< MAX_ALLOCS, TYPES >... > | objects |
| Util::PinnedArray< MAX_ALLOCS, Threading::ThreadId > | owners |
| Threading::Spinlock | allocationLock |
|
inline |
constructor
|
inline |
Allocate an object.
|
inline |
Deallocate an object. Just places it in freeids array for recycling.
|
private |
|
private |