Cogs.Core
|
Structure to hold a set of pointers with constant time insertion and removal. More...
Classes | |
struct | PointerEntry |
Public Member Functions | |
uint32_t | insert (ResourceBase *ptr) |
void | remove (uint32_t slot) |
size_t | size () const |
std::span< const PointerEntry > | view () const |
Static Public Attributes | |
static constexpr uint32_t | NoSlot = static_cast<uint32_t>(-1) |
static constexpr uint32_t | NotFree = static_cast<uint32_t>(-2) |
Private Attributes | |
std::vector< PointerEntry > | slots |
uint32_t | free = NoSlot |
size_t | numUsed = 0u |
Structure to hold a set of pointers with constant time insertion and removal.
The pointers are stored in a contiguous array which can be iterated over.
Definition at line 30 of file ResourceManagerBase.cpp.
|
inline |
Insert the given pointer into the map. The returned index can be used to remove the pointer at a later time.
Definition at line 42 of file ResourceManagerBase.cpp.
|
inline |
Remove the pointer at the given index. Typical problem if code asserts is double release.
Definition at line 63 of file ResourceManagerBase.cpp.
|
inline |
Definition at line 79 of file ResourceManagerBase.cpp.
|
inline |
Returns a view to the stored slots. Includes both active and deleted entries. Must check resource != nullptr
Definition at line 86 of file ResourceManagerBase.cpp.
|
private |
Definition at line 93 of file ResourceManagerBase.cpp.
|
staticconstexpr |
Definition at line 32 of file ResourceManagerBase.cpp.
|
staticconstexpr |
Definition at line 33 of file ResourceManagerBase.cpp.
|
private |
Definition at line 94 of file ResourceManagerBase.cpp.
|
private |
Definition at line 92 of file ResourceManagerBase.cpp.