template <typename T>
class IndexedSlab
Defined at line 87 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
A fixed capacity slab structure whose items are referenced by an index key.
The slab's capacity is set on creation. This slab is only capable of storing trivially
constructable and trivially destructible types.
This container is not thread-safe.
Public Methods
zx::result<std::unique_ptr<IndexedSlab<T>>> Create (uint32_t capacity)
Creates a new slab with the given capacity and stores it in `out`.
Returns an error if the provided capacity is invalid, or it failed to allocate the required
memory.
Defined at line 92 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
uint32_t Push (T data)
Pushes a new entry into the slab, returning a key to retrieve it.
Pushing into a full slab is invalid.
Defined at line 110 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
T & Get (uint32_t index)
Gets the entry referenced by `index`.
Getting an invalid reference is invalid.
Defined at line 123 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
void Free (uint32_t index)
Frees the entry referenced by `index`, returning the slot back to the Slab.
It is invalid to free an index which is not currently occupied.
Defined at line 131 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
uint32_t available ()
Gets the number of available slots in the slab.
Defined at line 141 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
uint32_t count ()
Gets the number of occupied slots in the slab.
Defined at line 143 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
uint32_t capacity ()
Gets the slab's capacity.
Defined at line 145 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
Iterator begin ()
Defined at line 178 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h
Iterator end ()
Defined at line 180 of file ../../src/connectivity/network/drivers/network-device/device/data_structs.h