stellarlib 0.1.0
Loading...
Searching...
No Matches
stellarlib::ecs::archetype Class Referencefinal

Represents the archetype of an entity. More...

#include <archetype.hpp>

Inheritance diagram for stellarlib::ecs::archetype:
stellarlib::ext::vector_allocator< std::uintmax_t >

Public Member Functions

 archetype () noexcept
 Default constructor.
 archetype (const archetype &other) noexcept
 Copy constructor.
 archetype (archetype &&other) noexcept
 Move constructor.
auto operator= (const archetype &other) noexcept -> archetype &
 Copy assignment operator.
auto operator= (archetype &&other) noexcept -> archetype &
 Move assignment operator.
 ~archetype () noexcept
 Destructor.
void insert (std::uintmax_t id) noexcept
 Inserts a component ID into the archetype.
void insert (const archetype &other) noexcept
 Inserts all component IDs that exist in another instance into the archetype.
auto contains (std::uintmax_t id) const noexcept -> bool
 Evaluates whether the archetype contains a component ID.
auto operator== (const archetype &other) const noexcept -> bool
 Comparison operator.
auto operator<= (const archetype &other) const noexcept -> bool
 Evaluates whether the current instance is the subtype of an other instance.
auto operator>= (const archetype &other) const noexcept -> bool
 Evaluates whether the current instance is the supertype of an other instance.
void erase (std::uintmax_t id) noexcept
 Removes a component ID from the archetype.
void erase (const archetype &other) noexcept
 Removes all component IDs that exist in another instance from the archetype.
void clear () noexcept
 Removes all component IDs from the archetype.

Static Public Member Functions

template<typename ... T>
static constexpr auto of () noexcept -> std::conditional_t< static_cast< bool >(sizeof...(T)), const archetype &, archetype >
 Retrieves an archetype for a set of component types.

Detailed Description

Represents the archetype of an entity.

Constructor & Destructor Documentation

◆ archetype() [1/2]

stellarlib::ecs::archetype::archetype ( const archetype & other)
nodiscardnoexcept

Copy constructor.

Parameters
otherOther instance

◆ archetype() [2/2]

stellarlib::ecs::archetype::archetype ( archetype && other)
nodiscardnoexcept

Move constructor.

Parameters
otherOther instance

Member Function Documentation

◆ of()

template<typename ... T>
constexpr auto stellarlib::ecs::archetype::of ( ) -> std::conditional_t< static_cast< bool >(sizeof...(T)), const archetype &, archetype >
inlinestaticnodiscardconstexprnoexcept

Retrieves an archetype for a set of component types.

Template Parameters
TComponent types
Returns
Archetype for a set of component types

◆ operator=() [1/2]

auto stellarlib::ecs::archetype::operator= ( const archetype & other) -> archetype &
noexcept

Copy assignment operator.

Parameters
otherOther instance
Returns
Current instance

◆ operator=() [2/2]

auto stellarlib::ecs::archetype::operator= ( archetype && other) -> archetype &
noexcept

Move assignment operator.

Parameters
otherOther instance
Returns
Current instance

◆ insert() [1/2]

void stellarlib::ecs::archetype::insert ( std::uintmax_t id)
noexcept

Inserts a component ID into the archetype.

Parameters
idComponent ID

◆ insert() [2/2]

void stellarlib::ecs::archetype::insert ( const archetype & other)
noexcept

Inserts all component IDs that exist in another instance into the archetype.

Parameters
otherOther instance

◆ contains()

auto stellarlib::ecs::archetype::contains ( std::uintmax_t id) const -> bool
nodiscardnoexcept

Evaluates whether the archetype contains a component ID.

Parameters
idComponent ID
Returns
Whether the archetype contains the component ID

◆ operator==()

auto stellarlib::ecs::archetype::operator== ( const archetype & other) const -> bool
nodiscardnoexcept

Comparison operator.

Parameters
otherOther instance
Returns
Result of the comparison

◆ operator<=()

auto stellarlib::ecs::archetype::operator<= ( const archetype & other) const -> bool
nodiscardnoexcept

Evaluates whether the current instance is the subtype of an other instance.

Parameters
otherOther instance
Returns
Whether the current instance is the subtype of the other instance

◆ operator>=()

auto stellarlib::ecs::archetype::operator>= ( const archetype & other) const -> bool
nodiscardnoexcept

Evaluates whether the current instance is the supertype of an other instance.

Parameters
otherOther instance
Returns
Whether the current instance is the supertype of the other instance

◆ erase() [1/2]

void stellarlib::ecs::archetype::erase ( std::uintmax_t id)
noexcept

Removes a component ID from the archetype.

Parameters
idComponent ID

◆ erase() [2/2]

void stellarlib::ecs::archetype::erase ( const archetype & other)
noexcept

Removes all component IDs that exist in another instance from the archetype.

Parameters
otherOther instance

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