template <typename _Key, typename _Meta = void>
class DynamicDispatchStorage
Defined at line 227 of file ../../src/lib/vmo_store/storage_types.h
Provides a `Backing` for `VmoStore` that uses any implementer of `AbstractStorage`.
This type of `Backing` can be used if the static dispatch option provided by `VmoStore` is not
feasible or desirable, such as providing C-bindings for `VmoStore`, for example.
`DynamicDispatchStorage` can be used to have different backing stores decided at runtime, at the
cost of having dynamic dispatch method calls, which can be slower than static dispatch.
For example, we can have two different backing store implementations and we can decide between
which to use at runtime, using the same `VmoStore` type:
class Foo: public AbstractStorage
<uint32
_t> { /* ... */ }
class Bar: public AbstractStorage
<uint32
_t> { /* ... */ }
using MyVmoStore = VmoStore
<DynamicDispatchStorage
<uint32
_t>>;
void MyFunction(bool foo_or_bar) {
MyVmoStore my_store(/* ... */,
std::unique_ptr
<AbstractStorage
>(foo_or_bar ? new Foo() : new Bar());
}
Public Methods
void DynamicDispatchStorage<_Key, _Meta> (BasePtr impl)
Defined at line 235 of file ../../src/lib/vmo_store/storage_types.h
zx_status_t Reserve (size_t capacity)
Defined at line 237 of file ../../src/lib/vmo_store/storage_types.h
zx_status_t Insert (Key key, Item && vmo)
Defined at line 238 of file ../../src/lib/vmo_store/storage_types.h
std::optional<Key> Push (Item && vmo)
Defined at line 241 of file ../../src/lib/vmo_store/storage_types.h
Item * Get (const Key & key)
Defined at line 242 of file ../../src/lib/vmo_store/storage_types.h
std::optional<Item> Extract (Key key)
Defined at line 243 of file ../../src/lib/vmo_store/storage_types.h
size_t count ()
Defined at line 244 of file ../../src/lib/vmo_store/storage_types.h
bool is_full ()
Defined at line 245 of file ../../src/lib/vmo_store/storage_types.h