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

Component set holds a set of components metadata. More...

#include <component.hpp>

Public Types

using size_type = std::size_t
 
using storage_type = std::vector<component_meta>
 
using value_type = typename storage_type::value_type
 
using const_iterator = typename storage_type::const_iterator
 

Public Member Functions

template<component T>
constexpr void insert ()
 Insert component of type T.
 
template<component T>
constexpr void erase ()
 Erase component of type T.
 
template<component T>
auto contains () const -> bool
 Check if component of type T is present in the set.
 
void insert (const value_type &meta)
 Inserts component into the set.
 
void erase (component_id_t id)
 Erases component from the set.
 
auto contains (component_id_t id) const -> bool
 Check if component is present in the set.
 
auto size () const noexcept -> size_type
 Returns how many components in the set.
 
auto begin () const noexcept -> const_iterator
 Return const iterator to beginning of the set.
 
auto end () const noexcept -> const_iterator
 Return const iterator to the end of the set.
 
auto cbegin () const noexcept -> const_iterator
 Return const iterator to beginning of the set.
 
auto cend () const noexcept -> const_iterator
 Return const iterator to the end of the set.
 
auto operator== (const component_meta_set &rhs) const noexcept -> bool
 Equality operator.
 
auto ids () const noexcept -> const component_set &
 Return a bitset of components.
 

Static Public Member Functions

template<component... Args>
static auto create () -> component_meta_set
 Construct component set from given component types.
 

Detailed Description

Component set holds a set of components metadata.

Member Typedef Documentation

◆ const_iterator

using co_ecs::component_meta_set::const_iterator = typename storage_type::const_iterator

◆ size_type

◆ storage_type

◆ value_type

using co_ecs::component_meta_set::value_type = typename storage_type::value_type

Member Function Documentation

◆ begin()

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

Return const iterator to beginning of the set.

Returns
const_iterator Iterator

◆ cbegin()

auto co_ecs::component_meta_set::cbegin ( ) const -> const_iterator
inlinenoexcept

Return const iterator to beginning of the set.

Returns
const_iterator Iterator

◆ cend()

auto co_ecs::component_meta_set::cend ( ) const -> const_iterator
inlinenoexcept

Return const iterator to the end of the set.

Returns
const_iterator Iterator

◆ contains() [1/2]

template<component T>
auto co_ecs::component_meta_set::contains ( ) const -> bool
inline

Check if component of type T is present in the set.

Template Parameters
TComponent type
Returns
true When component type T is present
false When component type T is not present

◆ contains() [2/2]

auto co_ecs::component_meta_set::contains ( component_id_t id) const -> bool
inline

Check if component is present in the set.

Parameters
idComponent ID
Returns
true When component ID is present
false When component ID is not present

◆ create()

template<component... Args>
static auto co_ecs::component_meta_set::create ( ) -> component_meta_set
inlinestatic

Construct component set from given component types.

Template Parameters
ArgsComponents type parameter pack
Returns
component_meta_set Component set

◆ end()

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

Return const iterator to the end of the set.

Returns
const_iterator Iterator

◆ erase() [1/2]

template<component T>
constexpr void co_ecs::component_meta_set::erase ( )
inlineconstexpr

Erase component of type T.

Template Parameters
TComponent type

◆ erase() [2/2]

void co_ecs::component_meta_set::erase ( component_id_t id)
inline

Erases component from the set.

Parameters
idComponent ID

◆ ids()

auto co_ecs::component_meta_set::ids ( ) const -> const component_set&
inlinenoexcept

Return a bitset of components.

Returns
const component_set& Component bitset

◆ insert() [1/2]

template<component T>
constexpr void co_ecs::component_meta_set::insert ( )
inlineconstexpr

Insert component of type T.

Template Parameters
TComponent type

◆ insert() [2/2]

void co_ecs::component_meta_set::insert ( const value_type & meta)
inline

Inserts component into the set.

Parameters
metaComponent meta

◆ operator==()

auto co_ecs::component_meta_set::operator== ( const component_meta_set & rhs) const -> bool
inlinenoexcept

Equality operator.

Parameters
rhsRight hand side
Returns
true If equal
false If not equal

◆ size()

auto co_ecs::component_meta_set::size ( ) const -> size_type
inlinenoexcept

Returns how many components in the set.

Returns
size_type Number of components in the set

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