Magnum::Ui::DataLayer class new in Git master

Data binding layer.

Setting up a data layer instance

If you create a UserInterfaceGL with a style and don't exclude StyleFeature::DataLayer, an implicit instance is already provided and available through UserInterface::dataLayer(). Otherwise, the layer doesn't have any shared state or configuration, so it's just about constructing it from a fresh AbstractUserInterface::createLayer() handle and passing it to UserInterface::setDataLayerInstance():

ui.setDataLayerInstance(Containers::pointer<Ui::DataLayer>(ui.createLayer()));

In comparison, if you want to set up a custom data layer that's independent of the one exposed through UserInterface::dataLayer(), pass the newly created instance to AbstractUserInterface::setLayerInstance() instead:

Ui::DataLayer& layer = ui.setLayerInstance(
    Containers::pointer<Ui::DataLayer>(ui.createLayer()));

Afterwards, with either of the above, assuming AbstractUserInterface::draw() is called in an appropriate place, the layer is ready to use.

Base classes

class AbstractLayer new in Git master
Base for data layers.

Constructors, destructors, conversion operators

DataLayer(LayerHandle handle) explicit
Constructor.
DataLayer(const DataLayer&) deleted
Copying is not allowed.
DataLayer(DataLayer&&) noexcept
Move constructor.

Public functions

auto operator=(const DataLayer&) -> DataLayer& deleted
Copying is not allowed.
auto operator=(DataLayer&&) -> DataLayer& noexcept
Move assignment.
auto usedAllocatedCount() const -> std::size_t
Count of allocated data update functions.
template<class Storage>
auto create(const Storage& storage, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null) -> DataHandle
Create a data binding for a single-item storage.
template<class Storage, class T>
auto create(const Storage& storage, T(Storage::*)() const member, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null) -> DataHandle
Create a data binding for a concrete member of a single-item storage.
template<class Storage>
auto create(const Storage& storage, std::size_t index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null) -> DataHandle
Create a data binding for a 1D storage.
template<class Storage, class T>
auto create(const Storage& storage, T(Storage::*)(std::size_t) const member, std::size_t index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null) -> DataHandle
Create a data binding for a concrete member of a 1D storage.
template<class Storage>
auto create(const Storage& storage, const Containers::Size2D& index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null) -> DataHandle
Create a data binding for a 2D storage.
template<class Storage, class T>
auto create(const Storage& storage, T(Storage::*)(const Containers::Size2D&) const member, const Containers::Size2D& index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null) -> DataHandle
Create a data binding for a concrete member of a 2D storage.
template<class Storage>
auto create(const Storage& storage, const Containers::Size3D& index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null) -> DataHandle
Create a data binding for a 3D storage.
template<class Storage, class T>
auto create(const Storage& storage, T(Storage::*)(const Containers::Size3D&) const member, const Containers::Size3D& index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null) -> DataHandle
Create a data binding for a concrete member of a 3D storage.
void remove(DataHandle handle)
Remove a data.
void remove(LayerDataHandle handle)
Remove an animation assuming it belongs to this animator.
auto isAllocated(DataHandle handle) const -> bool
Whether given data update function is allocated.
auto isAllocated(LayerDataHandle handle) const -> bool
Whether given data update function is allocated assuming it belongs to this layer.
auto isDirty(DataHandle handle) const -> bool
Whether given data is marked as dirty.
auto isDirty(LayerDataHandle handle) const -> bool
Whether given data is marked as dirty assuming it belongs to this layer.
auto storage(DataHandle handle) const -> StorageHandle
Storage given data is associated with.
auto storage(LayerDataHandle handle) const -> StorageHandle
Storage given data is associated with assuming it belongs to this layer.
auto index(DataHandle handle) const -> Containers::Size3D
Index of data in associated storage.
auto index(LayerDataHandle handle) const -> Containers::Size3D
Index of data in associated storage assuming it belongs to this layer.
void setIndex(DataHandle handle, std::size_t index)
Set data index in associated 1D storage.
void setIndex(LayerDataHandle handle, std::size_t index)
Set data index in associated 1D storage assuming it belongs to this layer.
void setIndex(DataHandle handle, const Containers::Size2D& index)
Set data index in associated 2D storage.
void setIndex(LayerDataHandle handle, const Containers::Size2D& index)
Set data index in associated 2D storage assuming it belongs to this layer.
void setIndex(DataHandle handle, const Containers::Size3D& index)
Set data index in associated 3D storage.
void setIndex(LayerDataHandle handle, const Containers::Size3D& index)
Set data index in associated 3D storage assuming it belongs to this layer.

Storage management

auto storageCapacity() const -> std::size_t
Current capacity of the storage storage.
auto storageUsedCount() const -> std::size_t
Count of used items in the storage storage.
auto storageUsedAllocatedCount() const -> std::size_t
Count of used allocated items in the storage storage.
auto isHandleValid(DataLayerStorageHandle handle) const -> bool
Whether a storage handle is valid.
auto isHandleValid(StorageHandle handle) const -> bool
Whether a storage handle is valid.
void removeStorage(StorageHandle handle)
Remove a storage.
void removeStorage(DataLayerStorageHandle handle)
Remove a storage assuming it belongs to this layer.
auto isStorageAllocated(StorageHandle handle) const -> bool
Whether given storage is allocated.
auto isStorageAllocated(DataLayerStorageHandle handle) const -> bool
Whether given storage is allocated assuming it belongs to this layer.
auto isStorageDirty(StorageHandle handle) const -> bool
Whether given storage is marked as dirty.
auto isStorageDirty(DataLayerStorageHandle handle) const -> bool
Whether given storage is marked as dirty assuming it belongs to this layer.
void setStorageDirty(StorageHandle handle)
Mark given storage as dirty.
void setStorageDirty(DataLayerStorageHandle handle)
Mark given storage as dirty assuming it belongs to this layer.
auto storageFlags(StorageHandle handle) const -> StorageFlags
Storage flags.
auto storageFlags(DataLayerStorageHandle handle) const -> StorageFlags
Storage flags assuming it belongs to this layer.
auto storageSize(StorageHandle handle) const -> Containers::Size3D
Storage size.
auto storageSize(DataLayerStorageHandle handle) const -> Containers::Size3D
Storage size assuming it belongs to this layer.
auto storageReferenceCount(StorageHandle handle) const -> std::size_t
Storage reference count.
auto storageReferenceCount(DataLayerStorageHandle handle) const -> std::size_t
Storage reference count assuming it belongs to this layer.
template<class Storage>
auto storage(StorageHandle handle) -> Storage
Storage access.
template<class Storage>
auto storage(DataLayerStorageHandle handle) -> Storage
Storage access assuming it belongs to this layer.
auto storageGenerations() const -> Containers::StridedArrayView1D<const UnsignedShort>
Generation counters for all storages.
auto isHandleValid(LayerDataHandle handle) const -> bool
Whether a data handle is valid.
auto isHandleValid(DataHandle handle) const -> bool
Whether a data handle is valid.

Function documentation

Magnum::Ui::DataLayer::DataLayer(LayerHandle handle) explicit

Constructor.

Parameters
handle Layer handle returned from AbstractUserInterface::createLayer()

Magnum::Ui::DataLayer::DataLayer(DataLayer&&) noexcept

Move constructor.

Performs a destructive move, i.e. the original object isn't usable afterwards anymore.

std::size_t Magnum::Ui::DataLayer::usedAllocatedCount() const

Count of allocated data update functions.

Always at most usedCount(). Counts all data update functions that capture non-trivially-copyable state or state that's too large to be stored in-place. The operation is done with a $ \mathcal{O}(n) $ complexity where $ n $ is capacity().

template<class Storage>
DataHandle Magnum::Ui::DataLayer::create(const Storage& storage, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null)

Create a data binding for a single-item storage.

Parameters
storage Storage to get the data from
update Function to call when data get updated
node Node to attach to
Returns New data handle

Expects that storage is a valid storage from this layer and update is not nullptr. The update gets called with the return value of operator*() const on storage during AbstractUserInterface::update() or draw() right after the data binding was created, and then every time storage is marked as dirty.

Use the create(const Storage&, T(Storage::*)() const, Containers::Function<void(T)>&&, NodeHandle) overload to query a concrete member function and the create(const Storage&, std::size_t, Containers::Function<void(T)>&&, NodeHandle), create(const Storage&, const Containers::Size2D&, Containers::Function<void(T)>&&, NodeHandle) and create(const Storage&, const Containers::Size3D&, Containers::Function<void(T)>&&, NodeHandle) overloads to pick value at a concrete index from 1D, 2D and 3D storage implementations.

Delegates to AbstractLayer::create(), see its documentation for detailed description of all constraints. Calling this function causes LayerState::NeedsCommonDataUpdate to be set.

template<class Storage, class T>
DataHandle Magnum::Ui::DataLayer::create(const Storage& storage, T(Storage::*)() const member, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null)

Create a data binding for a concrete member of a single-item storage.

Parameters
storage Storage to get the data from
member Storage member to query
update Function to call when data get updated
node Node to attach to
Returns New data handle

Expects that storage is a valid storage from this layer, and member and update are not nullptr. The update gets called with the return value of member on storage during AbstractUserInterface::update() or draw() right after the data binding was created, and then every time storage is marked as dirty.

Use the create(const Storage&, T(Storage::*)(std::size_t) const, std::size_t, Containers::Function<void(T)>&&, NodeHandle), create(const Storage&&, T(Storage::*)(const Containers::Size2D&) const, const Containers::Size2D&, Containers::Function<void(T)>&&, NodeHandle) and create(const Storage&&, T(Storage::*)(const Containers::Size3D&) const, const Containers::Size3D&, Containers::Function<void(T)>&&, NodeHandle) overloads to pick value at a concrete index from 1D, 2D and 3D storage implementations.

Delegates to AbstractLayer::create(), see its documentation for detailed description of all constraints. Calling this function causes LayerState::NeedsCommonDataUpdate to be set.

template<class Storage>
DataHandle Magnum::Ui::DataLayer::create(const Storage& storage, std::size_t index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null)

Create a data binding for a 1D storage.

Parameters
storage Storage to get the data from
index Value index to query
update Function to call when data get updated
node Node to attach to
Returns New data handle

Expects that storage is a valid storage from this layer, index is not larger than storage size in the last dimension, and update is not nullptr. The update gets called with the return value of operator[](std::size_t) const with given index on storage during AbstractUserInterface::update() or draw() right after the data binding was created, and then every time storage is marked as dirty.

Use the create(const Storage&, T(Storage::*)(std::size_t) const, std::size_t, Containers::Function<void(T)>&&, NodeHandle) overload to query a concrete member function.

Delegates to AbstractLayer::create(), see its documentation for detailed description of all constraints. Calling this function causes LayerState::NeedsCommonDataUpdate to be set.

template<class Storage, class T>
DataHandle Magnum::Ui::DataLayer::create(const Storage& storage, T(Storage::*)(std::size_t) const member, std::size_t index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null)

Create a data binding for a concrete member of a 1D storage.

Parameters
storage Storage to get the data from
member Storage member to query
index Value index to query
update Function to call when data get updated
node Node to attach to
Returns New data handle

Expects that storage is a valid storage from this layer, index is not larger than storage size in the last dimension, and member and update are not nullptr. The update gets called with the return value of member with given index on storage during AbstractUserInterface::update() or draw() whenever either the data itself or the storage is marked as dirty. The data is marked as dirty initially.

Delegates to AbstractLayer::create(), see its documentation for detailed description of all constraints. Calling this function causes LayerState::NeedsCommonDataUpdate to be set.

template<class Storage>
DataHandle Magnum::Ui::DataLayer::create(const Storage& storage, const Containers::Size2D& index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null)

Create a data binding for a 2D storage.

Parameters
storage Storage to get the data from
index Value index to query
update Function to call when data get updated
node Node to attach to
Returns New data handle

Expects that storage is a valid storage from this layer, index is not larger than storage size in the last two dimensions, and update is not nullptr. The update gets called with the return value of operator[](const Containers::Size2D&) const with given index on storage during AbstractUserInterface::update() or draw() right after the data binding was created, and then every time storage is marked as dirty.

Use the create(const Storage&, T(Storage::*)(std::size_t) const, std::size_t, Containers::Function<void(T)>&&, NodeHandle) overload to query a concrete member function.

Delegates to AbstractLayer::create(), see its documentation for detailed description of all constraints. Calling this function causes LayerState::NeedsCommonDataUpdate to be set.

template<class Storage, class T>
DataHandle Magnum::Ui::DataLayer::create(const Storage& storage, T(Storage::*)(const Containers::Size2D&) const member, const Containers::Size2D& index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null)

Create a data binding for a concrete member of a 2D storage.

Parameters
storage Storage to get the data from
member Storage member to query
index Value index to query
update Function to call when data get updated
node Node to attach to
Returns New data handle

Expects that storage is a valid storage from this layer, index is not larger than storage size in the last two dimensions, and member and update are not nullptr. The update gets called with the return value of member with given index on storage during AbstractUserInterface::update() or draw() right after the data binding was created, and then every time storage is marked as dirty.

Delegates to AbstractLayer::create(), see its documentation for detailed description of all constraints. Calling this function causes LayerState::NeedsCommonDataUpdate to be set.

template<class Storage>
DataHandle Magnum::Ui::DataLayer::create(const Storage& storage, const Containers::Size3D& index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null)

Create a data binding for a 3D storage.

Parameters
storage Storage to get the data from
index Value index to query
update Function to call when data get updated
node Node to attach to
Returns New data handle

Expects that storage is a valid storage from this layer, index is not larger than storage size, and update is not nullptr. The update gets called with the return value of operator[](const Containers::Size3D&) const with given index on storage during AbstractUserInterface::update() or draw() right after the data binding was created, and then every time storage is marked as dirty.

Use the create(const Storage&, T(Storage::*)(std::size_t) const, std::size_t, Containers::Function<void(T)>&&, NodeHandle) overload to query a concrete member function.

Delegates to AbstractLayer::create(), see its documentation for detailed description of all constraints. Calling this function causes LayerState::NeedsCommonDataUpdate to be set.

template<class Storage, class T>
DataHandle Magnum::Ui::DataLayer::create(const Storage& storage, T(Storage::*)(const Containers::Size3D&) const member, const Containers::Size3D& index, Containers::Function<void(T)>&& update, NodeHandle node = NodeHandle::Null)

Create a data binding for a concrete member of a 3D storage.

Parameters
storage Storage to get the data from
member Storage member to query
index Value index to query
update Function to call when data get updated
node Node to attach to
Returns New data handle

Expects that storage is a valid storage from this layer, index is not larger than storage size, and member and update are not nullptr. The update gets called with the return value of member with given index on storage during AbstractUserInterface::update() or draw() right after the data binding was created, and then every time storage is marked as dirty.

Delegates to AbstractLayer::create(), see its documentation for detailed description of all constraints. Calling this function causes LayerState::NeedsCommonDataUpdate to be set.

void Magnum::Ui::DataLayer::remove(DataHandle handle)

Remove a data.

Expects that handle is valid. Calls a destructor on the captured update function state, if it's not trivially destructible, and decrements reference count on the storage the data was associated with. Delegates to AbstractLayer::remove(DataHandle), see its documentation for detailed description of all constraints.

If the storage the handle was associated with is StorageFlag::ReferenceCounted and its reference count becomes 0 by calling this function, causes LayerState::NeedsCommonDataUpdate to be set on the layer in addition to what AbstractLayer::remove() may have set.

void Magnum::Ui::DataLayer::remove(LayerDataHandle handle)

Remove an animation assuming it belongs to this animator.

Compared to remove(DataHandle) delegates to AbstractLayer::remove(LayerDataHandle) instead.

bool Magnum::Ui::DataLayer::isAllocated(DataHandle handle) const

Whether given data update function is allocated.

Returns true if the update function in given data captures non-trivially-copyable state or state that's too large to be stored in-place, false otherwise. Expects that handle is valid.

bool Magnum::Ui::DataLayer::isAllocated(LayerDataHandle handle) const

Whether given data update function is allocated assuming it belongs to this layer.

Like isAllocated(DataHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

bool Magnum::Ui::DataLayer::isDirty(DataHandle handle) const

Whether given data is marked as dirty.

Returns true if the data update function will be called in the next AbstractUserInterface::update() or draw(), false otherwise. Expects that handle is valid.

All data are marked as dirty upon creation in order to have the update function called at least once, and the dirty bits is reset in the next AbstractUserInterface::update() or draw(). Afterwards, they're themselves marked as dirty only if their properties change such as when setIndex() is called, and there's no way to mark them as dirty explicitly. All other cases where the update function is called are driven by dirty state of the associated storage.

bool Magnum::Ui::DataLayer::isDirty(LayerDataHandle handle) const

Whether given data is marked as dirty assuming it belongs to this layer.

Like isDirty(DataHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

StorageHandle Magnum::Ui::DataLayer::storage(DataHandle handle) const

Storage given data is associated with.

Expects that handle is valid. The returned storage handle is always valid and belongs to this layer.

StorageHandle Magnum::Ui::DataLayer::storage(LayerDataHandle handle) const

Storage given data is associated with assuming it belongs to this layer.

Like storage(DataHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

Containers::Size3D Magnum::Ui::DataLayer::index(DataHandle handle) const

Index of data in associated storage.

Expects that handle is valid. If the data was created without specifying an index, with a 1D index or with a 2D index, returns 0 in remaining leading dimensions. For example, if the data was created with a 2D index of {3, 7}, the returned 3D index is going to be {0, 3, 7}.

Containers::Size3D Magnum::Ui::DataLayer::index(LayerDataHandle handle) const

Index of data in associated storage assuming it belongs to this layer.

Like index(DataHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

void Magnum::Ui::DataLayer::setIndex(DataHandle handle, std::size_t index)

Set data index in associated 1D storage.

Expects that handle is valid, size of associated storage is {1, 1, size} and index is less than size. Use setIndex(DataHandle, const Containers::Size2D&) for setting a data index in a 2D storage and setIndex(DataHandle, const Containers::Size3D&) for setting an index in a 3D storage.

If the index is different from the previously used index, calling this function causes the data to be marked as dirty and LayerState::NeedsCommonDataUpdate to be set.

void Magnum::Ui::DataLayer::setIndex(LayerDataHandle handle, std::size_t index)

Set data index in associated 1D storage assuming it belongs to this layer.

Like setIndex(DataHandle, std::size_t) but without checking that handle indeed belongs to this layer. See its documentation for more information.

void Magnum::Ui::DataLayer::setIndex(DataHandle handle, const Containers::Size2D& index)

Set data index in associated 2D storage.

Expects that handle is valid, size of associated storage is {1, size[0], size[1]} and index is less than size. Use setIndex(DataHandle, const Containers::Size3D&) for setting a data index in a 3D storage.

If the index is different from the previously used index, calling this function causes the data to be marked as dirty and LayerState::NeedsCommonDataUpdate to be set.

void Magnum::Ui::DataLayer::setIndex(LayerDataHandle handle, const Containers::Size2D& index)

Set data index in associated 2D storage assuming it belongs to this layer.

Like setIndex(DataHandle, const Containers::Size2D&) but without checking that handle indeed belongs to this layer. See its documentation for more information.

void Magnum::Ui::DataLayer::setIndex(DataHandle handle, const Containers::Size3D& index)

Set data index in associated 3D storage.

Expects that handle is valid and index is less than size of the associated storage.

If the index is different from the previously used index, calling this function causes the data to be marked as dirty and LayerState::NeedsCommonDataUpdate to be set.

void Magnum::Ui::DataLayer::setIndex(LayerDataHandle handle, const Containers::Size3D& index)

Set data index in associated 3D storage assuming it belongs to this layer.

Like setIndex(DataHandle, const Containers::Size3D&) but without checking that handle indeed belongs to this layer. See its documentation for more information.

std::size_t Magnum::Ui::DataLayer::storageCapacity() const

Current capacity of the storage storage.

Can be at most 1048576. If an AbstractStorage subclass instance is constructed and there's no free slots left, the internal storage gets grown.

std::size_t Magnum::Ui::DataLayer::storageUsedCount() const

Count of used items in the storage storage.

Always at most storageCapacity(). Expired handles are counted among used as well. The operation is done with a $ \mathcal{O}(n) $ complexity where $ n $ is storageCapacity().

std::size_t Magnum::Ui::DataLayer::storageUsedAllocatedCount() const

Count of used allocated items in the storage storage.

Always at most storageUsedCount(). Counts all storages that have non-trivially-copyable state or state that's too large to be stored in-place. The operation is done with a $ \mathcal{O}(n) $ complexity where $ n $ is storageCapacity().

bool Magnum::Ui::DataLayer::isHandleValid(DataLayerStorageHandle handle) const

Whether a storage handle is valid.

A handle is valid if it has been created via an AbstractStorage subclass constructor and removeStorage() wasn't called on it yet. For DataLayerStorageHandle::Null always returns false.

bool Magnum::Ui::DataLayer::isHandleValid(StorageHandle handle) const

Whether a storage handle is valid.

A shorthand for extracting a LayerHandle from handle using storageHandleLayer(), comparing it to handle() and if it's the same, calling isHandleValid(DataLayerStorageHandle) const with a DataLayerStorageHandle extracted from handle using storageHandleStorage(). See these functions for more information. For StorageHandle::Null, LayerHandle::Null or DataLayerStorageHandle::Null always returns false.

void Magnum::Ui::DataLayer::removeStorage(StorageHandle handle)

Remove a storage.

Expects that handle is valid and the storage isn't referenced by any data. Calls a deleter on the storage if it's allocated.

void Magnum::Ui::DataLayer::removeStorage(DataLayerStorageHandle handle)

Remove a storage assuming it belongs to this layer.

Like removeStorage(StorageHandle) but without checking that handle indeed belongs to this layer. See its documentation for more information.

bool Magnum::Ui::DataLayer::isStorageAllocated(StorageHandle handle) const

Whether given storage is allocated.

Returns true if given storage has a non-trivially-copyable type or its size is too large to be stored in-place, false otherwise. Expects that handle is valid.

bool Magnum::Ui::DataLayer::isStorageAllocated(DataLayerStorageHandle handle) const

Whether given storage is allocated assuming it belongs to this layer.

Like isStorageAllocated(StorageHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

bool Magnum::Ui::DataLayer::isStorageDirty(StorageHandle handle) const

Whether given storage is marked as dirty.

Returns true if data update functions for given storage will be called in the next AbstractUserInterface::update() or draw(), false otherwise. Expects that handle is valid.

The storage is not marked as dirty upon creation, the data themselves however are marked as dirty when created in order to have their update function called at least once.

bool Magnum::Ui::DataLayer::isStorageDirty(DataLayerStorageHandle handle) const

Whether given storage is marked as dirty assuming it belongs to this layer.

Like isStorageDirty(StorageHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

void Magnum::Ui::DataLayer::setStorageDirty(StorageHandle handle)

Mark given storage as dirty.

Calling this function causes update functions for data associated with this storage to be called in the next AbstractUserInterface::update() or draw(). Expects that handle is valid.

Calling this function causes LayerState::NeedsCommonDataUpdate to be set, unless the storage has a zero reference count and thus no update functions need to be called.

void Magnum::Ui::DataLayer::setStorageDirty(DataLayerStorageHandle handle)

Mark given storage as dirty assuming it belongs to this layer.

Like setStorageDirty(StorageHandle) but without checking that handle indeed belongs to this layer. See its documentation for more information.

StorageFlags Magnum::Ui::DataLayer::storageFlags(StorageHandle handle) const

Storage flags.

Expects that handle is valid.

StorageFlags Magnum::Ui::DataLayer::storageFlags(DataLayerStorageHandle handle) const

Storage flags assuming it belongs to this layer.

Like storageFlags(StorageHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

Containers::Size3D Magnum::Ui::DataLayer::storageSize(StorageHandle handle) const

Storage size.

Expects that handle is valid. If the storage was created without specifying a size, with a 1D size or with a 2D size, returns 1 in remaining leading dimensions. For example, if the storage was created with a 2D size of {4, 12}, the returned 3D size is going to be {1, 4, 12}.

Containers::Size3D Magnum::Ui::DataLayer::storageSize(DataLayerStorageHandle handle) const

Storage size assuming it belongs to this layer.

Like storageSize(StorageHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

std::size_t Magnum::Ui::DataLayer::storageReferenceCount(StorageHandle handle) const

Storage reference count.

Expects that handle is valid. Initially 0, is incremented after every create() call referencing given handle and decremented after every remove() of data referencing given handle, or when a node the data is attached to is removed along with all attachments. Can be at most usedCount(). It's only allowed to removeStorage() with a zero reference count.

std::size_t Magnum::Ui::DataLayer::storageReferenceCount(DataLayerStorageHandle handle) const

Storage reference count assuming it belongs to this layer.

Like storageReferenceCount(StorageHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

template<class Storage>
Storage Magnum::Ui::DataLayer::storage(StorageHandle handle)

Storage access.

Expects that handle is valid, it's user responsibility to ensure that Storage is matching the AbstractStorage subclass used for creating the storage with given handle.

Note that because the returned instance generally allows unconditionally mutating the storage contents, there's no const overload of this function.

template<class Storage>
Storage Magnum::Ui::DataLayer::storage(DataLayerStorageHandle handle)

Storage access assuming it belongs to this layer.

Like storage(StorageHandle) but without checking that handle indeed belongs to this layer. See its documentation for more information.

Containers::StridedArrayView1D<const UnsignedShort> Magnum::Ui::DataLayer::storageGenerations() const

Generation counters for all storages.

Meant to be used by code that only gets storage IDs or masks but needs the full handle, or for various diagnostic purposes such as tracking handle recycling. Size of the returned view is the same as storageCapacity(), individual items correspond to generations of particular storage IDs. All values fit into the StorageHandle / DataLayerStorageHandle generation bits, 0 denotes an expired generation counter.

Passing an ID along with the corresponding generation to dataLayerStorageHandle() produces a DataLayerStorageHandle, passing that along with handle() to storageHandle() produces a StorageHandle. Use isHandleValid(DataLayerStorageHandle) const / isHandleValid(StorageHandle) const to determine whether given slot is actually used.

bool Magnum::Ui::DataLayer::isHandleValid(LayerDataHandle handle) const

Whether a data handle is valid.

A handle is valid if it has been returned from create() before and remove() wasn't called on it yet. For LayerDataHandle::Null always returns false.

bool Magnum::Ui::DataLayer::isHandleValid(DataHandle handle) const

Whether a data handle is valid.

A shorthand for extracting a LayerHandle from handle using dataHandleLayer(), comparing it to handle() and if it's the same, calling isHandleValid(LayerDataHandle) const with a LayerDataHandle extracted from handle using dataHandleData(). See these functions for more information. For DataHandle::Null, LayerHandle::Null or LayerDataHandle::Null always returns false.