#include <Magnum/Ui/NumericStorage.h>
template<class T>
NumericStorage class new in Git master
Multi-dimensional storage for numeric types.
Owns or references typed numeric data for use with DataLayer, providing also a way to update them along with customizable value range and steps for incrementing and decrementing.
The template is explicitly instantiated for UnsignedByte, Byte, UnsignedShort, Short, UnsignedInt, Int, UnsignedLong, Long, Float, Double, Half, Deg, Rad, Seconds and Nanoseconds. To reduce the amount of used StorageQuery types, types smaller than 32 bits are implicitly expanded to a corresponding 32-bit type in returned StorageQuery instances. Other types are currently not supported.
Base classes
- class AbstractStorage new in Git master
- Base for DataLayer storage implementations.
Public types
- using StorageType = T
- Storage type.
- using Type = Implementation::NumericStorageQueryTraits<T>::Type
- Query type.
Constructors, destructors, conversion operators
- NumericStorage(DataLayer& layer, ValueInitT, StorageFlags flags = {}) explicit
- Construct a value-initialized single-item storage.
-
NumericStorage(DataLayer& layer,
ValueInitT,
std::
size_t size, StorageFlags flags = {}) explicit - Construct a value-initialized 1D storage.
-
NumericStorage(DataLayer& layer,
ValueInitT,
const Containers::
Size2D& size, StorageFlags flags = {}) explicit - Construct a value-initialized 2D storage.
-
NumericStorage(DataLayer& layer,
ValueInitT,
const Containers::
Size3D& size, StorageFlags flags = {}) explicit - Construct a value-initialized 3D storage.
-
template<class UserInterface>NumericStorage(UserInterface& ui, ValueInitT, StorageFlags flags = {}) explicit
- Construct a value-initialized single-item storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, ValueInitT, std::
size_t size, StorageFlags flags = {}) explicit - Construct a value-initialized 1D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, ValueInitT, const Containers::
Size2D& size, StorageFlags flags = {}) explicit - Construct a value-initialized 2D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, ValueInitT, const Containers::
Size3D& size, StorageFlags flags = {}) explicit - Construct a value-initialized 3D storage using the default DataLayer in given user interface.
- NumericStorage(DataLayer& layer, NoInitT, StorageFlags flags = {}) explicit
- Construct a single-item storage without initializing its contents.
-
NumericStorage(DataLayer& layer,
NoInitT,
std::
size_t size, StorageFlags flags = {}) explicit - Construct a 1D storage without initializing its contents.
-
NumericStorage(DataLayer& layer,
NoInitT,
const Containers::
Size2D& size, StorageFlags flags = {}) explicit - Construct a 2D storage without initializing its contents.
-
NumericStorage(DataLayer& layer,
NoInitT,
const Containers::
Size3D& size, StorageFlags flags = {}) explicit - Construct a 3D storage without initializing its contents.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NoInitT, StorageFlags flags = {}) explicit
- Construct a single-item storage without initializing its contents using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NoInitT, std::
size_t size, StorageFlags flags = {}) explicit - Construct a 1D storage without initializing its contents using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NoInitT, const Containers::
Size2D& size, StorageFlags flags = {}) explicit - Construct a 2D storage without initializing its contents using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NoInitT, const Containers::
Size3D& size, StorageFlags flags = {}) explicit - Construct a 3D storage without initializing its contents using the default DataLayer in given user interface.
- NumericStorage(DataLayer& layer, DirectInitT, const T& value, StorageFlags flags = {}) explicit
- Construct a direct-initialized single-item storage.
-
NumericStorage(DataLayer& layer,
DirectInitT,
std::
size_t size, const T& value, StorageFlags flags = {}) explicit - Construct a direct-initialized 1D storage.
-
NumericStorage(DataLayer& layer,
DirectInitT,
const Containers::
Size2D& size, const T& value, StorageFlags flags = {}) explicit - Construct a direct-initialized 2D storage.
-
NumericStorage(DataLayer& layer,
DirectInitT,
const Containers::
Size3D& size, const T& value, StorageFlags flags = {}) explicit - Construct a direct-initialized 3D storage.
-
template<class UserInterface>NumericStorage(UserInterface& ui, DirectInitT, const T& value, StorageFlags flags = {}) explicit
- Construct a direct-initialized single-item storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, DirectInitT, std::
size_t size, const T& value, StorageFlags flags = {}) explicit - Construct a direct-initialized 1D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, DirectInitT, const Containers::
Size2D& size, const T& value, StorageFlags flags = {}) explicit - Construct a direct-initialized 2D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, DirectInitT, const Containers::
Size3D& size, const T& value, StorageFlags flags = {}) explicit - Construct a direct-initialized 3D storage using the default DataLayer in given user interface.
- NumericStorage(DataLayer& layer, NonOwnedT, T& value, StorageFlags flags = {}) explicit
- Construct a non-owned single-item storage.
- NumericStorage(DataLayer& layer, NonOwnedT, const T& value, StorageFlags flags = {}) explicit
- NumericStorage(DataLayer& layer, NonOwnedT, T&& value, StorageFlags flags = {}) deleted explicit
- Constructing a non-owned storage from a r-value reference is not allowed.
- NumericStorage(DataLayer& layer, NonOwnedT, const T&& value, StorageFlags flags = {}) deleted explicit
- Constructing a non-owned storage from a r-value reference is not allowed.
-
NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers::
StridedArrayView1D<T>& values, StorageFlags flags = {}) explicit - Construct a non-owned 1D storage.
-
NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers::
StridedArrayView1D<const T>& values, StorageFlags flags = {}) explicit -
NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers::
StridedArrayView2D<T>& values, StorageFlags flags = {}) explicit - Construct a non-owned 2D storage.
-
NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers::
StridedArrayView2D<const T>& values, StorageFlags flags = {}) explicit -
NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers::
StridedArrayView3D<T>& values, StorageFlags flags = {}) explicit - Construct a non-owned 3D storage.
-
NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers::
StridedArrayView3D<const T>& values, StorageFlags flags = {}) explicit -
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, T& value, StorageFlags flags = {}) explicit
- Construct a non-owned single-item storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, const T& value, StorageFlags flags = {}) explicit
-
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, T&& value, StorageFlags flags = {}) deleted explicit
- Constructing a non-owned storage from a r-value reference is not allowed.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, const T&& value, StorageFlags flags = {}) deleted explicit
- Constructing a non-owned storage from a r-value reference is not allowed.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, const Containers::
StridedArrayView1D<T>& values, StorageFlags flags = {}) explicit - Construct a non-owned 1D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, const Containers::
StridedArrayView1D<const T>& values, StorageFlags flags = {}) explicit -
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, const Containers::
StridedArrayView2D<T>& values, StorageFlags flags = {}) explicit - Construct a non-owned 2D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, const Containers::
StridedArrayView2D<const T>& values, StorageFlags flags = {}) explicit -
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, const Containers::
StridedArrayView3D<T>& values, StorageFlags flags = {}) explicit - Construct a non-owned 3D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, NonOwnedT, const Containers::
StridedArrayView3D<const T>& values, StorageFlags flags = {}) explicit - NumericStorage(DataLayer& layer, StorageFlags flags = {}) explicit
- Construct a value-initialized single-item storage.
-
NumericStorage(DataLayer& layer,
std::
size_t size, StorageFlags flags = {}) explicit - Construct a value-initialized 1D storage.
-
NumericStorage(DataLayer& layer,
const Containers::
Size2D& size, StorageFlags flags = {}) explicit - Construct a value-initialized 2D storage.
-
NumericStorage(DataLayer& layer,
const Containers::
Size3D& size, StorageFlags flags = {}) explicit - Construct a value-initialized 3D storage.
-
template<class UserInterface>NumericStorage(UserInterface& ui, StorageFlags flags = {}) explicit
- Construct a value-initialized single-item storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, std::
size_t size, StorageFlags flags = {}) explicit - Construct a value-initialized 1D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, const Containers::
Size2D& size, StorageFlags flags = {}) explicit - Construct a value-initialized 2D storage using the default DataLayer in given user interface.
-
template<class UserInterface>NumericStorage(UserInterface& ui, const Containers::
Size3D& size, StorageFlags flags = {}) explicit - Construct a value-initialized 3D storage using the default DataLayer in given user interface.
- operator StorageQuery<Type>() const
- Single-item storage value query.
Public functions
-
auto stride() const -> Containers::
Stride3D - Storage stride.
-
auto range() const -> Containers::
Pair<T, T> - Accepted value range.
- auto setRange(T min, T max) const -> const NumericStorage<T>&
- Set accepted value range.
- auto step() const -> T
- Step for increment and decrement.
- auto setStep(T step) const -> const NumericStorage<T>&
- Set step for increment and decrement.
- auto value() const -> StorageQuery<Type>
- Single-item storage value.
-
auto operator[](std::
size_t index) const -> StorageQuery<Type> - 1D storage value at given index
-
auto operator[](const Containers::
Size2D& index) const -> StorageQuery<Type> - 2D storage value at given index
-
auto operator[](const Containers::
Size3D& index) const -> StorageQuery<Type> - 3D storage value at given index
-
auto data() const -> Containers::
StridedArrayView3D<const T> - Raw storage data.
Typedef documentation
template<class T>
typedef T Magnum:: Ui:: NumericStorage<T>:: StorageType
Storage type.
Note that to reduce combinatorial explosion, the types retured by queries don't always match the actual storage type. See Type for details.
template<class T>
typedef Implementation::NumericStorageQueryTraits<T>::Type Magnum:: Ui:: NumericStorage<T>:: Type
Query type.
To reduce the amount of used StorageQuery types, types smaller than 32 bits are implicitly expanded to a corresponding 32-bit type in returned StorageQuery instances, in particular for StorageType being UnsignedByte and UnsignedShort the StorageQuery type returned by value() expands to UnsignedInt, Byte and Short expands to Int, and Half expands to Float. Otherwise the storage and query type is the same.
Function documentation
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
ValueInitT,
StorageFlags flags = {}) explicit
Construct a value-initialized single-item storage.
Equivalent to calling NumericStorage(DataLayer&, ValueInitT, const Containers::size being {1, 1, 1}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
ValueInitT,
std:: size_t size,
StorageFlags flags = {}) explicit
Construct a value-initialized 1D storage.
Equivalent to calling NumericStorage(DataLayer&, ValueInitT, const Containers::size being {1, 1, size}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
ValueInitT,
const Containers:: Size2D& size,
StorageFlags flags = {}) explicit
Construct a value-initialized 2D storage.
Equivalent to calling NumericStorage(DataLayer&, ValueInitT, const Containers::size being {1, size[0], size[1]}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
ValueInitT,
const Containers:: Size3D& size,
StorageFlags flags = {}) explicit
Construct a value-initialized 3D storage.
| Parameters | |
|---|---|
| layer | Data layer to create the storage in |
| size | Storage size |
| flags | Storage flags |
Delegates to NumericStorage(DataLayer&, NoInitT, const Containers::
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
ValueInitT,
StorageFlags flags = {}) explicit
Construct a value-initialized single-item storage using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, ValueInitT, const Containers::size being {1, 1, 1}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
ValueInitT,
std:: size_t size,
StorageFlags flags = {}) explicit
Construct a value-initialized 1D storage using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, ValueInitT, const Containers::size being {1, 1, size}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
ValueInitT,
const Containers:: Size2D& size,
StorageFlags flags = {}) explicit
Construct a value-initialized 2D storage using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, ValueInitT, const Containers::size being {1, size[0], size[1]}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
ValueInitT,
const Containers:: Size3D& size,
StorageFlags flags = {}) explicit
Construct a value-initialized 3D storage using the default DataLayer in given user interface.
Like NumericStorage(DataLayer&, ValueInitT, const Containers::ui contains a DataLayer instance.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NoInitT,
StorageFlags flags = {}) explicit
Construct a single-item storage without initializing its contents.
Equivalent to calling NumericStorage(DataLayer&, NoInitT, const Containers::size being {1, 1, 1}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NoInitT,
std:: size_t size,
StorageFlags flags = {}) explicit
Construct a 1D storage without initializing its contents.
Equivalent to calling NumericStorage(DataLayer&, ValueInitT, const Containers::size being {1, 1, size}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NoInitT,
const Containers:: Size2D& size,
StorageFlags flags = {}) explicit
Construct a 2D storage without initializing its contents.
Equivalent to calling NumericStorage(DataLayer&, ValueInitT, const Containers::size being {1, size[0], size[1]}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NoInitT,
const Containers:: Size3D& size,
StorageFlags flags = {}) explicit
Construct a 3D storage without initializing its contents.
| Parameters | |
|---|---|
| layer | Data layer to create the storage in |
| size | Storage size |
| flags | Storage flags |
Expects that the size is non-empty. While the stored value is not initialized in any way, the range() is set to min and max representable values of given type, and step() is set to T(1).
Delegates to AbstractStorage::
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NoInitT,
StorageFlags flags = {}) explicit
Construct a single-item storage without initializing its contents using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, NoInitT, const Containers::size being {1, 1, 1}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NoInitT,
std:: size_t size,
StorageFlags flags = {}) explicit
Construct a 1D storage without initializing its contents using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, NoInitT, const Containers::size being {1, 1, size}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NoInitT,
const Containers:: Size2D& size,
StorageFlags flags = {}) explicit
Construct a 2D storage without initializing its contents using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, NoInitT, const Containers::size being {1, size[0], size[1]}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NoInitT,
const Containers:: Size3D& size,
StorageFlags flags = {}) explicit
Construct a 3D storage without initializing its contents using the default DataLayer in given user interface.
Like NumericStorage(DataLayer&, NoInitT, const Containers::ui contains a DataLayer instance.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
DirectInitT,
const T& value,
StorageFlags flags = {}) explicit
Construct a direct-initialized single-item storage.
Equivalent to calling NumericStorage(DataLayer&, DirectInitT, const Containers::size being {1, 1, 1}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
DirectInitT,
std:: size_t size,
const T& value,
StorageFlags flags = {}) explicit
Construct a direct-initialized 1D storage.
Equivalent to calling NumericStorage(DataLayer&, DirectInitT, const Containers::size being {1, 1, size}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
DirectInitT,
const Containers:: Size2D& size,
const T& value,
StorageFlags flags = {}) explicit
Construct a direct-initialized 2D storage.
Equivalent to calling NumericStorage(DataLayer&, DirectInitT, const Containers::size being {1, size[0], size[1]}.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
DirectInitT,
const Containers:: Size3D& size,
const T& value,
StorageFlags flags = {}) explicit
Construct a direct-initialized 3D storage.
| Parameters | |
|---|---|
| layer | Data layer to create the storage in |
| size | Storage size |
| value | Value to initialize the storage with |
| flags | Storage flags |
Delegates to NumericStorage(DataLayer&, NoInitT, const Containers::value. See the documentation of NumericStorage(DataLayer&, NoInitT, const Containers::
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
DirectInitT,
const T& value,
StorageFlags flags = {}) explicit
Construct a direct-initialized single-item storage using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, DirectInitT, const Containers::size being {1, 1, 1}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
DirectInitT,
std:: size_t size,
const T& value,
StorageFlags flags = {}) explicit
Construct a direct-initialized 1D storage using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, DirectInitT, const Containers::size being {1, 1, size}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
DirectInitT,
const Containers:: Size2D& size,
const T& value,
StorageFlags flags = {}) explicit
Construct a direct-initialized 2D storage using the default DataLayer in given user interface.
Equivalent to calling NumericStorage(UserInterface&, DirectInitT, const Containers::size being {1, size[0], size[1]}.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
DirectInitT,
const Containers:: Size3D& size,
const T& value,
StorageFlags flags = {}) explicit
Construct a direct-initialized 3D storage using the default DataLayer in given user interface.
Like NumericStorage(DataLayer&, DirectInitT, const Containers::ui contains a DataLayer instance.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
T& value,
StorageFlags flags = {}) explicit
Construct a non-owned single-item storage.
Behaves like calling NumericStorage(DataLayer&, NonOwnedT, const Containers::value turned into a view of size {1, 1, 1} but results in a more compact internal representation.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
const T& value,
StorageFlags flags = {}) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
T&& value,
StorageFlags flags = {}) explicit deleted
Constructing a non-owned storage from a r-value reference is not allowed.
This prevents the storage to be accidentally constructed from a temporary value instead.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
const T&& value,
StorageFlags flags = {}) explicit deleted
Constructing a non-owned storage from a r-value reference is not allowed.
This prevents the storage to be accidentally constructed from a temporary value instead.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers:: StridedArrayView1D<T>& values,
StorageFlags flags = {}) explicit
Construct a non-owned 1D storage.
Behaves like calling NumericStorage(DataLayer&, NonOwnedT, const Containers::values turned into a view of size {1, 1, values.size()} but results in a more compact internal representation.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers:: StridedArrayView1D<const T>& values,
StorageFlags flags = {}) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers:: StridedArrayView2D<T>& values,
StorageFlags flags = {}) explicit
Construct a non-owned 2D storage.
Behaves like calling NumericStorage(DataLayer&, NonOwnedT, const Containers::values turned into a view of size {1, values.size()[0], values.size()[1]} but results in a more compact internal representation.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers:: StridedArrayView2D<const T>& values,
StorageFlags flags = {}) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers:: StridedArrayView3D<T>& values,
StorageFlags flags = {}) explicit
Construct a non-owned 3D storage.
| Parameters | |
|---|---|
| layer | Data layer to create the storage in |
| values | Value view |
| flags | Storage flags |
Uses the values view as the storage instead of allocating it. The values view is expected to be non-empty with its contents staying in scope for the whole storage lifetime. If the values are a const view, data updates through the storage are not possible. The range() is set to min and max representable values of given type, and step() is set to T(1).
It's expected that setDirty() is called whenever the value is modified externally. Also note that external modifications don't get clamped against the range() and as such the query values may fall outside of it.
Delegates to AbstractStorage::
Delegates to NumericStorage(DataLayer&, NoInitT, StorageFlags) and then uses the pointed-to value as the storage, along with remembering whether it's mutable. See the documentation of NumericStorage(DataLayer&, NoInitT, StorageFlags) for more information.
The value is expected to stay in scope for the whole storage lifetime. If the value is a const reference, data updates through the storage are not possible. It's expected that setDirty() is called whenever the value is modified externally. Also note that there's no way to clamp external modifications against the range() and as such the query values may fall outside of it.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
NonOwnedT,
const Containers:: StridedArrayView3D<const T>& values,
StorageFlags flags = {}) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
T& value,
StorageFlags flags = {}) explicit
Construct a non-owned single-item storage using the default DataLayer in given user interface.
Behaves like calling NumericStorage(UserInterface&, NonOwnedT, const Containers::values turned into a view of size {1, 1, 1} but results in a more compact internal representation.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
const T& value,
StorageFlags flags = {}) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
T&& value,
StorageFlags flags = {}) explicit deleted
Constructing a non-owned storage from a r-value reference is not allowed.
This prevents the storage to be accidentally constructed from a temporary value instead.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
const T&& value,
StorageFlags flags = {}) explicit deleted
Constructing a non-owned storage from a r-value reference is not allowed.
This prevents the storage to be accidentally constructed from a temporary value instead.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
const Containers:: StridedArrayView1D<T>& values,
StorageFlags flags = {}) explicit
Construct a non-owned 1D storage using the default DataLayer in given user interface.
Behaves like calling NumericStorage(UserInterface&, NonOwnedT, const Containers::values turned into a view of size {1, 1, values.size()} but results in a more compact internal representation.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
const Containers:: StridedArrayView1D<const T>& values,
StorageFlags flags = {}) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
const Containers:: StridedArrayView2D<T>& values,
StorageFlags flags = {}) explicit
Construct a non-owned 2D storage using the default DataLayer in given user interface.
Behaves like calling NumericStorage(UserInterface&, NonOwnedT, const Containers::values turned into a view of size {1, values.size()[0], values.size()[1]} but results in a more compact internal representation.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
const Containers:: StridedArrayView2D<const T>& values,
StorageFlags flags = {}) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
const Containers:: StridedArrayView3D<T>& values,
StorageFlags flags = {}) explicit
Construct a non-owned 3D storage using the default DataLayer in given user interface.
Like NumericStorage(DataLayer&, NonOwnedT, const Containers::ui contains a DataLayer instance.
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
NonOwnedT,
const Containers:: StridedArrayView3D<const T>& values,
StorageFlags flags = {}) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
StorageFlags flags = {}) explicit
Construct a value-initialized single-item storage.
Alias to NumericStorage(DataLayer&, ValueInitT, StorageFlags).
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
std:: size_t size,
StorageFlags flags = {}) explicit
Construct a value-initialized 1D storage.
Alias to NumericStorage(DataLayer&, ValueInitT, std::
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
const Containers:: Size2D& size,
StorageFlags flags = {}) explicit
Construct a value-initialized 2D storage.
Alias to NumericStorage(DataLayer&, ValueInitT, const Containers::
template<class T>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(DataLayer& layer,
const Containers:: Size3D& size,
StorageFlags flags = {}) explicit
Construct a value-initialized 3D storage.
Alias to NumericStorage(DataLayer&, ValueInitT, const Containers::
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
StorageFlags flags = {}) explicit
Construct a value-initialized single-item storage using the default DataLayer in given user interface.
Alias to NumericStorage(UserInterface&, ValueInitT, StorageFlags).
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
std:: size_t size,
StorageFlags flags = {}) explicit
Construct a value-initialized 1D storage using the default DataLayer in given user interface.
Alias to NumericStorage(UserInterface&, ValueInitT, std::
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
const Containers:: Size2D& size,
StorageFlags flags = {}) explicit
Construct a value-initialized 2D storage using the default DataLayer in given user interface.
Alias to NumericStorage(UserInterface&, ValueInitT, const Containers::
template<class T>
template<class UserInterface>
Magnum:: Ui:: NumericStorage<T>:: NumericStorage(UserInterface& ui,
const Containers:: Size3D& size,
StorageFlags flags = {}) explicit
Construct a value-initialized 3D storage using the default DataLayer in given user interface.
Alias to NumericStorage(UserInterface&, ValueInitT, const Containers::
template<class T>
Magnum:: Ui:: NumericStorage<T>:: operator StorageQuery<Type>() const
Single-item storage value query.
Equivalent to value(), see its documentation for more information.
template<class T>
Containers:: Stride3D Magnum:: Ui:: NumericStorage<T>:: stride() const
Storage stride.
In case of an owned storage (created using the ValueInit, NoInit or DirectInit constructor variants) the elements are stored tightly packed. In case of a non-owned storage (created using the NonOwned constructor) the stride can be arbitrary.
template<class T>
const NumericStorage<T>& Magnum:: Ui:: NumericStorage<T>:: setRange(T min,
T max) const
Set accepted value range.
| Returns | Reference to self (for method chaining) |
|---|
Expects that min isn't larger than max. The range is used to clamp the value when setting, incrementing and decrementing it through StorageQuery APIs, as well as setting it to a min or max. Note that setting the range doesn't clamp existing values in the storage, it only affects future updates. Similarly it also doesn't affect external updates in a non-owned storage.
For integer types the default is the min and max representable value, e.g. -32768 and 32768 for Short, for floating-point types it's negative and positive infinity.
If the range is different from the previously used range, calling this function causes the storage to be marked as dirty.
template<class T>
const NumericStorage<T>& Magnum:: Ui:: NumericStorage<T>:: setStep(T step) const
Set step for increment and decrement.
| Returns | Reference to self (for method chaining) |
|---|
Expects that step is not 0. The step is used just for incrementing and decrementing the value (for as long as the range() allows), the values can still be set to any value between individual steps without getting rounded.
The default step is 1 for both integer and floating-point types. Setting a negative step value will cause the effect of StorageQuery::
Unlike setRange(), calling this function does not cause the storage to be marked as dirty, as it doesn't have any effect on the values
template<class T>
StorageQuery<Type> Magnum:: Ui:: NumericStorage<T>:: value() const
Single-item storage value.
Expects that size() is {1, 1, 1}. If it's not, use one of the operator[]() overloads.
See documentation of operator[](const Containers::
template<class T>
StorageQuery<Type> Magnum:: Ui:: NumericStorage<T>:: operator[](std:: size_t index) const
1D storage value at given index
Expects that size() is {1, 1, size} and index is less than size. Use operator[](const Containers::
See documentation of operator[](const Containers::
template<class T>
StorageQuery<Type> Magnum:: Ui:: NumericStorage<T>:: operator[](const Containers:: Size2D& index) const
2D storage value at given index
Expects that size() is {1, size[0], size[1]} and index is less than size. Use operator[](const Containers::
See documentation of operator[](const Containers::
template<class T>
StorageQuery<Type> Magnum:: Ui:: NumericStorage<T>:: operator[](const Containers:: Size3D& index) const
3D storage value at given index
Expects that index is less than size().
The returned query supports StorageOperation::
Note that to reduce combinatorial type explosion, the query uses a Type which is always at least 32-bit. All value updates ultimately use the original StorageType however. Use value<U>() if you need a query in a different type.
template<class T>
Containers:: StridedArrayView3D<const T> Magnum:: Ui:: NumericStorage<T>:: data() const
Raw storage data.
Meant to be used mainly for diagnostic purposes. For mutable access use the StorageQuery instances returned by value() and operator[]().
In case of an owned storage (created using the ValueInit, NoInit or DirectInit constructor variants) the returned view is tightly packed with a size of size(). In case of a non-owned storage (created using the NonOwned constructor) the returned view matches the one passed to the constructor, possibly with extra dimensions added at the front.