sandbox
Loading...
Searching...
No Matches
sbx::ecs::basic_storage< Type, Entity, Allocator > Class Template Reference
Inheritance diagram for sbx::ecs::basic_storage< Type, Entity, Allocator >:
sbx::ecs::basic_sparse_set< Entity, Allocator >

Public Types

using allocator_type = Allocator
 
using base_type = underlying_type
 
using element_type = Type
 
using value_type = element_type
 
using entity_type = Entity
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using pointer = typename container_type::pointer
 
using const_pointer = typename allocator_traits::template rebind_traits< typename allocator_traits::const_pointer >::const_pointer
 
using iterator = detail::storage_iterator< container_type, component_traits::page_size >
 
using const_iterator = detail::storage_iterator< const container_type, component_traits::page_size >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using iterable = memory::iterable_adaptor< detail::extended_storage_iterator< typename base_type::iterator, iterator > >
 
using const_iterable = memory::iterable_adaptor< detail::extended_storage_iterator< typename base_type::const_iterator, const_iterator > >
 
- Public Types inherited from sbx::ecs::basic_sparse_set< Entity, Allocator >
using allocator_type = Allocator
 
using entity_type = entity_traits::value_type
 
using version_type = entity_traits::version_type
 
using pointer = typename dense_storage_type::pointer
 
using const_pointer = typename dense_storage_type::const_pointer
 
using reference = typename dense_storage_type::reference
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using iterator = detail::sparse_set_iterator< dense_storage_type >
 
using const_iterator = iterator
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

 basic_storage (const allocator_type &allocator)
 
 basic_storage (const basic_storage &other)=delete
 
 basic_storage (basic_storage &&other) noexcept
 
auto operator= (const basic_storage &other) -> basic_storage &=delete
 
auto operator= (basic_storage &&other) noexcept -> basic_storage &
 
auto swap (basic_storage &other) noexcept -> void
 
constexpr auto get_allocator () const noexcept -> allocator_type
 
auto reserve (const size_type capacity) -> void override
 Reserves dense storage capacity. More...
 
auto get (const entity_type entity) const noexcept -> const value_type &
 
auto get (const entity_type entity) noexcept -> value_type &
 
auto get_as_tuple (const entity_type entity) const noexcept -> std::tuple< const value_type & >
 
auto get_as_tuple (const entity_type entity) noexcept -> std::tuple< value_type & >
 
auto cbegin () const noexcept -> const_iterator
 
auto begin () const noexcept -> const_iterator
 
auto begin () noexcept -> iterator
 
auto cend () const noexcept -> const_iterator
 
auto end () const noexcept -> const_iterator
 
auto end () noexcept -> iterator
 
template<typename... Args>
requires (std::is_constructible_v<value_type, Args...>)
auto emplace (const entity_type entity, Args &&... args) -> value_type &
 
template<typename Function >
requires (std::is_invocable_v<Function, value_type&>)
auto patch (const entity_type entity, Function &&function) -> value_type &
 
template<typename Iterator >
auto insert (iterator first, iterator last, const value_type &value=value_type{}) -> iterator
 
auto each () noexcept -> iterable
 
auto each () const noexcept -> const_iterable
 
template<typename Callable >
requires (std::is_invocable_r_v<void, Callable, const entity_type, Type&>)
auto add_meta (const utility::hashed_string &tag, Callable &&callable) -> void
 
- Public Member Functions inherited from sbx::ecs::basic_sparse_set< Entity, Allocator >
 basic_sparse_set (const deletion_policy policy=deletion_policy::unspecified, const allocator_type &allocator=allocator_type{})
 Constructs an empty sparse set. More...
 
 basic_sparse_set (const basic_sparse_set &other)=delete
 Deleted copy constructor. More...
 
 basic_sparse_set (basic_sparse_set &&other) noexcept
 Move-constructs a sparse set. More...
 
 basic_sparse_set (basic_sparse_set &&other, const allocator_type &allocator)
 Move-constructs a sparse set using a specific allocator. More...
 
virtual ~basic_sparse_set ()
 Destroys the sparse set. More...
 
auto operator= (const basic_sparse_set &other) -> basic_sparse_set &=delete
 Deleted copy assignment operator. More...
 
auto operator= (basic_sparse_set &&other) noexcept -> basic_sparse_set &
 Move-assigns a sparse set. More...
 
auto swap (basic_sparse_set &other) noexcept -> void
 Swaps the contents of two sparse sets.
 
constexpr auto get_allocator () const noexcept -> allocator_type
 Returns the allocator associated with the container.
 
auto policy () const noexcept -> deletion_policy
 Returns the deletion policy.
 
auto free_list () const noexcept -> size_type
 Returns the index of the free-list head.
 
virtual void reserve (const size_type capacity)
 Reserves dense storage capacity. More...
 
virtual auto capacity () const noexcept -> size_type
 Returns dense storage capacity.
 
auto extent () const noexcept -> size_type
 Returns sparse storage extent.
 
auto size () const noexcept -> size_type
 Returns the number of stored entities.
 
auto is_empty () const noexcept -> bool
 Checks whether the set is empty.
 
auto is_contiguous () const noexcept -> bool
 Checks whether the dense storage is contiguous.
 
auto data () const noexcept -> const_pointer
 Returns pointer to dense storage.
 
auto data () noexcept -> pointer
 Returns pointer to dense storage.
 
auto bump (const entity_type entity) -> version_type
 Updates the version of an entity.
 
auto begin () const noexcept -> iterator
 Returns iterator to the first element.
 
auto cbegin () const noexcept -> const_iterator
 Returns const iterator to the first element.
 
auto end () const noexcept -> iterator
 Returns iterator to the end.
 
auto cend () const noexcept -> const_iterator
 Returns const iterator to the end.
 
bool contains (const entity_type entity) const noexcept
 Checks whether an entity exists in the set.
 
auto current (const entity_type entity) const noexcept -> version_type
 Returns the current version of an entity.
 
auto find (const entity_type entity) const noexcept -> const_iterator
 Finds an entity iterator.
 
auto index (const entity_type entity) const noexcept -> size_type
 Returns the dense index of an entity.
 
auto erase (const entity_type entity) -> void
 Removes an entity.
 
auto remove (const entity_type entity) -> bool
 Removes an entity if present.
 
template<typename Compare , typename Sort = utility::std_sort, typename... Args>
auto sort (Compare compare, Sort sort=Sort{}, Args &&... args) -> void
 Sorts entities using a comparator.
 
template<typename Compare , typename Sort = utility::std_sort, typename... Args>
auto sort_n (const size_type length, Compare compare, Sort sort=Sort{}, Args &&... args) -> void
 Sorts the first N entities.
 
auto clear () -> void
 Clears all entities.
 
auto invoke (const utility::hashed_string &tag, const entity_type entity) -> void
 Invokes a tagged callback on an entity.
 

Static Public Attributes

static constexpr auto storage_policy = static_cast<deletion_policy>(component_traits::in_place_delete)
 

Protected Member Functions

auto call (const utility::hashed_string &tag, const entity_type entity) -> void override
 
auto pop (underlying_iterator first, underlying_iterator last) -> void override
 
auto pop_all () -> void override
 
auto try_emplace (const entity_type entity, const bool force_back) -> underlying_iterator override
 
- Protected Member Functions inherited from sbx::ecs::basic_sparse_set< Entity, Allocator >
virtual auto call (const utility::hashed_string &tag, const entity_type entity) -> void
 Virtual callback hook.
 
void swap_only (const basic_iterator iterator)
 
auto swap_and_pop (const basic_iterator iterator) -> void
 
auto in_place_pop (const basic_iterator iterator) -> void
 
virtual auto pop (basic_iterator first, basic_iterator last) -> void
 
virtual auto pop_all () -> void
 
virtual auto try_emplace (const entity_type entity, const bool force_back) -> basic_iterator
 

Additional Inherited Members

- Protected Types inherited from sbx::ecs::basic_sparse_set< Entity, Allocator >
using basic_iterator = iterator
 

Member Function Documentation

◆ pop()

template<typename Type , typename Entity , memory::allocator_for< Type > Allocator = std::allocator<Type>>
auto sbx::ecs::basic_storage< Type, Entity, Allocator >::pop ( underlying_iterator  first,
underlying_iterator  last 
) -> void
overrideprotectedvirtual

◆ pop_all()

template<typename Type , typename Entity , memory::allocator_for< Type > Allocator = std::allocator<Type>>
auto sbx::ecs::basic_storage< Type, Entity, Allocator >::pop_all ( ) -> void
overrideprotectedvirtual

◆ reserve()

template<typename Type , typename Entity , memory::allocator_for< Type > Allocator = std::allocator<Type>>
auto sbx::ecs::basic_storage< Type, Entity, Allocator >::reserve ( const size_type  capacity) -> void
overridevirtual

Reserves dense storage capacity.

Reimplemented from sbx::ecs::basic_sparse_set< Entity, Allocator >.


The documentation for this class was generated from the following file: