class
staged_sparse_memory_region_tA specialized container type to store components in a type agnostic manner.
static member functions
constructors, destructors, conversion operators
member-functions
Function documentation
template<IsValidForStagedSparseMemoryRange T>
static FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: instantiate() -> staged_sparse_memory_region_t
Brief
Safe (and preferred) method of creating a staged_
Template parameters | |
---|---|
T | component type this should be storing (only used for size) |
Returns | An instance of staged_ set up to be used with the given type |
psl:: ecs:: details:: staged_sparse_memory_region_t:: staged_sparse_memory_region_t(size_t size)
Details
Parameters | |
---|---|
size | element size in the container |
FORCEINLINE void psl:: ecs:: details:: staged_sparse_memory_region_t:: clear() noexcept
Brief
Revert the object back to a safe default stage.
Details
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: has(key_ type index,
stage_ range_ t stage = stage_range_t:: ALIVE) const noexcept -> bool
Brief
Checks if the given index exist in the requested range.
Parameters | |
---|---|
index | Index to check |
stage | Stage that will be searched in |
Returns | Boolean containing true if found |
template<IsValidForStagedSparseMemoryRange T>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: operator[](key_ type index) -> T & constexpr
Brief
Fetch or create the item at the given index.
Template parameters | |
---|---|
T | Used to check the expected component size |
Parameters | |
index | Where the item would be |
Returns | The object as T at the given location |
template<IsValidForStagedSparseMemoryRange T>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: get(key_ type index,
stage_ range_ t stage = stage_range_t:: ALL) const -> T & constexpr
Brief
Fetch the item at the given index.
Details
Template parameters | |
---|---|
T | Used to check the expected component size |
Parameters | |
index | Where the item would be |
stage | The stage_range_t to search the index. |
Returns | The object as T at the given location |
template<IsValidForStagedSparseMemoryRange T>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: set(key_ type index,
const T& value) -> bool constexpr
Brief
Sets the value at the given index.
Template parameters | |
---|---|
T | Type of the component (used for size and assignment) |
Parameters | |
index | Index of the item |
value | The value to set at the given index |
Returns | Boolean value indicating if the index was successfuly set or not |
template<IsValidForStagedSparseMemoryRange T>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: dense(stage_ range_ t stage = stage_range_t:: ALIVE) const noexcept -> psl::array_view< T >
Brief
Get a view of the underlying data for the given stage_range_t
Template parameters | |
---|---|
T | Component type to interpret the data as |
Parameters | |
stage | stage_range_t to limit what data is returned |
Returns | A view of the underlying data as the requested type |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: indices(stage_ range_ t stage = stage_range_t:: ALIVE) const noexcept -> psl::array_view< key_type >
Brief
Get a view of the indices for the given stage_range_t
Parameters | |
---|---|
stage | stage_range_t to limit what indices are returned |
Returns | A view of the indices |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: data(stage_ t stage = stage_t:: SETTLED) noexcept -> pointer
Brief
Get the data pointer for the given stage (where the data begins)
Parameters | |
---|---|
stage | stage_t to retrieve |
Returns | A pointer to the head of the dense data |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: cdata(stage_ t stage = stage_t:: SETTLED) const noexcept -> const_pointer
Brief
Get the data pointer for the given stage (where the data begins)
Parameters | |
---|---|
stage | stage_t to retrieve |
Returns | A pointer to the head of the dense data |
template<IsValidForStagedSparseMemoryRange T>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: at(key_ type index,
stage_ range_ t stage = stage_range_t:: ALIVE) const noexcept -> T const &
Brief
Get a reference of the requested type at the index.
Details
Template parameters | |
---|---|
T | Type we want to interpret the data as |
Parameters | |
index | Where to look |
stage | Used to limit the stages we wish to look in |
Returns | Given memory address as a const ref |
template<IsValidForStagedSparseMemoryRange T>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: at(key_ type index,
stage_ range_ t stage = stage_range_t:: ALIVE) noexcept -> T &
Brief
Get a reference of the requested type at the index.
Details
Template parameters | |
---|---|
T | Type we want to interpret the data as |
Parameters | |
index | Where to look |
stage | Used to limit the stages we wish to look in |
Returns | Given memory address as a const ref |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: addressof(key_ type index,
stage_ range_ t stage = stage_range_t:: ALIVE) const noexcept -> const_pointer
Brief
Get a pointer of the data at the index.
Details
Parameters | |
---|---|
index | Where to look |
stage | Used to limit the stages we wish to look in |
Returns | memory address |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: addressof(key_ type index,
stage_ range_ t stage = stage_range_t:: ALIVE) noexcept -> pointer
Brief
Get a pointer of the data at the index.
Details
Parameters | |
---|---|
index | Where to look |
stage | Used to limit the stages we wish to look in |
Returns | memory address |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: addressof_if(key_ type index,
stage_ range_ t stage = stage_range_t:: ALIVE) const noexcept -> const_pointer
Brief
Get a pointer of the data at the index, or nullptr when not found.
Parameters | |
---|---|
index | Where to look |
stage | Used to limit the stages we wish to look in |
Returns | memory address or nullptr |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: addressof_if(key_ type index,
stage_ range_ t stage = stage_range_t:: ALIVE) noexcept -> pointer
Brief
Get a pointer of the data at the index, or nullptr when not found.
Parameters | |
---|---|
index | Where to look |
stage | Used to limit the stages we wish to look in |
Returns | memory address or nullptr |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: dense_index_for(key_ type index,
stage_ range_ t stage = stage_range_t:: ALIVE) const noexcept -> key_type
Brief
Retrieves the internal index for the dense data for the given index.
Parameters | |
---|---|
index | Where to look |
stage | Used to limit the stages we wish to look in |
Returns | Index of the data relative to the data() (note that this does not take the type's size in account) |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: erase(key_ type first,
key_ type last) noexcept -> size_t
Brief
Erases all values between the first/last indices.
Parameters | |
---|---|
first | Begin of the range |
last | End of the range |
Returns | Amount of elements erased |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: erase(key_ type index) noexcept -> size_t
Brief
Erases value at the given index.
Parameters | |
---|---|
index | Index to erase |
Returns | Amount of elements erased (0 or 1) |
template<IsValidForStagedSparseMemoryRange T>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert(key_ type index,
const T& value) -> void
Brief
Inserts an item at the given index.
Details
Template parameters | |
---|---|
T | The type of the element to insert |
Parameters | |
index | Where to insert it |
value | The value to insert |
template<typename ItF, typename ItL>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert(key_ type index,
ItF&& begin,
ItL&& end) -> void
Brief
Inserts all items [begin, end) starting from the index.
Details
Parameters | |
---|---|
index | First index to where to start the insertions |
begin | Iterator to the beginning of the values range |
end | Iterator to the end of the values range |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert(key_ type index) -> void
Brief
Insert an element at the given index.
Parameters | |
---|---|
index | Location to insert a value |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert(key_ type* begin,
key_ type* end) -> void
Brief
Insert a range of elements from [begin, end).
Parameters | |
---|---|
begin | Iterator to the first element. |
end | Iterator to one beyond the last element. |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert(key_ type index,
key_ type count) -> void
Brief
Insert a range of elements at the given index.
Parameters | |
---|---|
index | Location of the first element |
count | How many items to insert (the range is [index, index+count) |
template<typename Fn>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert(key_ type* begin,
key_ type* end,
Fn&& callback) -> void
Brief
Insert a range of elements from [begin, end), and invoke the callback with the memory address associated with it.
Parameters | |
---|---|
begin | Iterator to the first element. |
end | Iterator to one beyond the last element. |
callback | Function of the signature void(std::byte*, std::byte*) to invoke. Where the second element is the end ptr. |
template<typename Fn>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert(key_ type index,
key_ type count,
Fn&& callback) -> void
Brief
Insert a range of elements at the given index, and invoke the callback with the memory address associated with it.
Parameters | |
---|---|
index | Location of the first element |
count | How many items to insert (the range is [index, index+count) |
callback | Function of the signature void(std::byte*, std::byte*) to invoke. Where the second element is the end ptr. |
template<typename Fn>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert(key_ type index,
Fn&& callback) -> void
Brief
Insert an element at the given index, and invoke the callback with the memory address associated with it.
Parameters | |
---|---|
index | Location to insert a value |
callback | Function of the signature void(std::byte*) to invoke. |
template<typename Fn>
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: remap(const psl:: sparse_array<key_ type>& mapping,
Fn&& predicate) -> void
Brief
Remaps the current instance based on the mapping provided.
Details
accesses all indices in the current container rejecting those who don't satisfy the predicate. Those who weren't rejected by the predicate are then looked up in the mapping
value, and their return value is used to re-assign the index in the current container. f.e. if the mapping had a value of { 100, 200 } (index, value), and the predicate didn't reject the item on our end, then what was at 100 in this container would be remapped to the index 200.
Template parameters | |
---|---|
Fn | |
Parameters | |
mapping | The mapping to use |
predicate | Predicate that returns a boolean value if the index was found |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: merge(const staged_ sparse_ memory_ region_ t& other) noexcept -> merge_result
Brief
Merges 2 staged_
Parameters | |
---|---|
other | the staged_ |
Returns | object that contains { .success /* bool /, .total / total items processed, inserted + replaced /, .added / amount that was inserted into the current container */ } |
FORCEINLINE auto psl:: ecs:: details:: staged_sparse_memory_region_t:: insert_make_space(key_ type size = 1) -> void private
Brief
Makes sure there is insertion space for N elements.
Parameters | |
---|---|
size | Amount of elements to make space for |