co_ecs 0.9.0
Cobalt ECS
Loading...
Searching...
No Matches
co_ecs::archetypes Class Reference

Container for archetypes, holds a map from component set to archetype. More...

#include <archetype.hpp>

Public Types

using storage_type = detail::hash_map<component_set, std::unique_ptr<archetype>, component_set_hasher>
 Underlying container storage type.
 
using iterator = storage_type::iterator
 
using const_iterator = storage_type::const_iterator
 
using value_type = storage_type::value_type
 
using key_type = storage_type::key_type
 
using mapped_type = storage_type::mapped_type
 

Public Member Functions

auto ensure_archetype (const component_meta_set &components) -> archetype *
 Get or create an archetype given the component meta set.
 
template<component... Components>
auto ensure_archetype () -> archetype *
 Get or create an archetype matching the passed Components types.
 
template<component... Components>
auto ensure_archetype_added (const archetype *anchor_archetype) -> archetype *
 Get or create an archetype by adding new Components to an anchor archetype.
 
template<component... Components>
auto ensure_archetype_removed (const archetype *anchor_archetype) -> archetype *
 Get or create an archetype by removing Components from an anchor archetype.
 
auto begin () noexcept -> iterator
 Returns iterator to the beginning of archetypes container.
 
auto end () noexcept -> iterator
 Returns an iterator to the end of archetypes container.
 
auto begin () const noexcept -> const_iterator
 Returns iterator to the beginning of archetypes container.
 
auto end () const noexcept -> const_iterator
 Returns an iterator to the end of archetypes container.
 
auto size () const noexcept -> std::size_t
 Returns the number of archetypes.
 

Detailed Description

Container for archetypes, holds a map from component set to archetype.

Member Typedef Documentation

◆ const_iterator

using co_ecs::archetypes::const_iterator = storage_type::const_iterator

◆ iterator

using co_ecs::archetypes::iterator = storage_type::iterator

◆ key_type

using co_ecs::archetypes::key_type = storage_type::key_type

◆ mapped_type

using co_ecs::archetypes::mapped_type = storage_type::mapped_type

◆ storage_type

Underlying container storage type.

◆ value_type

using co_ecs::archetypes::value_type = storage_type::value_type

Member Function Documentation

◆ begin() [1/2]

auto co_ecs::archetypes::begin ( ) const -> const_iterator
inlinenoexcept

Returns iterator to the beginning of archetypes container.

Returns
decltype(auto)

◆ begin() [2/2]

auto co_ecs::archetypes::begin ( ) -> iterator
inlinenoexcept

Returns iterator to the beginning of archetypes container.

Returns
decltype(auto)

◆ end() [1/2]

auto co_ecs::archetypes::end ( ) const -> const_iterator
inlinenoexcept

Returns an iterator to the end of archetypes container.

Returns
decltype(auto)

◆ end() [2/2]

auto co_ecs::archetypes::end ( ) -> iterator
inlinenoexcept

Returns an iterator to the end of archetypes container.

Returns
decltype(auto)

◆ ensure_archetype() [1/2]

template<component... Components>
auto co_ecs::archetypes::ensure_archetype ( ) -> archetype*
inline

Get or create an archetype matching the passed Components types.

Template Parameters
ComponentsComponent types
Returns
archetype*

◆ ensure_archetype() [2/2]

auto co_ecs::archetypes::ensure_archetype ( const component_meta_set & components) -> archetype*
inline

Get or create an archetype given the component meta set.

Parameters
componentsComponents meta set
Returns
archetype*

◆ ensure_archetype_added()

template<component... Components>
auto co_ecs::archetypes::ensure_archetype_added ( const archetype * anchor_archetype) -> archetype*
inline

Get or create an archetype by adding new Components to an anchor archetype.

Template Parameters
ComponentsComponents to add
Parameters
anchor_archetypeAnchor archetype
Returns
archetype*

◆ ensure_archetype_removed()

template<component... Components>
auto co_ecs::archetypes::ensure_archetype_removed ( const archetype * anchor_archetype) -> archetype*
inline

Get or create an archetype by removing Components from an anchor archetype.

Template Parameters
ComponentsComponents to remove
Parameters
anchor_archetypeAnchor archetype
Returns
archetype*

◆ size()

auto co_ecs::archetypes::size ( ) const -> std::size_t
inlinenoexcept

Returns the number of archetypes.

Returns
std::size_t

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