Struct DefaultStorage::Allocator¶
Defined in File default_storage.hpp
Nested Relationships¶
This struct is a nested type of Template Struct DefaultStorage.
Struct Documentation¶
-
struct
ripple::DefaultStorage
::
Allocator
¶ Allocator for default storage.
This can be used to determine the memory requirement for the storage for different spatial configurations, as well as to offset DefaultStorage elements within the allocated space.
Public Static Functions
-
constexpr auto
strided_types
() noexcept -> size_t¶ Gets the number of types which are stored strided.
- Return
The number of types which are stored strided.
-
template<size_t
I
>
constexpr autonum_elements
() noexcept -> size_t¶ Gets the number of elements in the Ith type.
- Return
The number of elements in the ith type.
- Template Parameters
I
: The index of the type.
-
template<size_t
I
>
constexpr autoelement_byte_size
() noexcept -> size_t¶ Gets the number of bytes for an elemeent in the Ith type.
- Return
The number of bytes for an element in the Ith type.
- Template Parameters
I
: The index of the type to get the element size of.
-
constexpr auto
allocation_size
(size_t elements) noexcept -> size_t¶ Gets the number of bytes required to allocate a total of
elements
of the types defined by Ts.- Return
The number of bytes required to allocate the given number of elements.
- Parameters
elements
: The number of elements to allocate.
-
template<size_t
Elements
>
constexpr autoallocation_size
() noexcept -> size_t¶ Gets the number of bytes required to allocate a total of Elements of the types defined by Ts.
This overload of the function can be used to allocate static memory when the number of elements in the space is known at compile time.
- Return
The number of bytes required to allocate the given number of elements.
- Template Parameters
Elements
: The number of elements to allocate.
-
template<typename
SpaceImpl
, typenameDim
, diff_enable_t<Dim, int> = 0>
autooffset
(const Storage &storage, const MultidimSpace<SpaceImpl> &space, Dim &&dim, int amount) -> Storage¶ Offsets the storage by the amount specified by
amount
in the dimensiondim
.- Return
A new DefaultStorage offset by the given amount.
- Parameters
storage
: The storage to offset.space
: The space for which the storage is defined.dim
: The dimension to offset in.
- Template Parameters
SpaceImpl
: The implementation of the spatial interface.Dim
: The type of the dimension.
-
template<typename
SpaceImpl
, typenameDim
>
autoshift
(Storage &storage, const MultidimSpace<SpaceImpl> &space, Dim &&dim, int amount) -> void¶ Shifts the storage by the amount specified by
amount
in the dimensiondim
.- Parameters
storage
: The storage to offset.space
: The space for which the storage is defined.dim
: The dimension to offset in.
- Template Parameters
SpaceImpl
: The implementation of the spatial interface.Dim
: The type of the dimension.
-
template<typename
SpaceImpl
>
autocreate
(void *ptr, const MultidimSpace<SpaceImpl> &space) -> Storage¶ Creates the storage, initializing a T instance which points to
ptr
.- Return
A new DefaultStorage type pointing to the given pointer.
- Parameters
ptr
: A pointer to the beginning of the memory space.space
: The multidimensional space which defines the domain.
- Template Parameters
SpaceImpl
: The implementation of the spatial interface.
-
constexpr auto