Engine → ECS → component.h
component_mask
| Type | Class |
| Namespace | conjure::core::json |
| Include File Path | engine/include/conjure/ecs/component.h |
| Source File Path | N/A |
| API ↗ | Entities and components |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | constexpr component_mask() noexcept = default; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mWords | std:: | {} | |
| public | WORD_COUNT | static constexpr u32 | MAX_ | Number of 64-bit words. |
Functions
Public
clear
clearconstexpr void clear(
component_id id) noexcept;Clears the bit of id. Invalid ids assert and are ignored.
contains_all
contains_all[[nodiscard]] constexpr bool contains_all(
const component_mask &other) const noexcept;True when every bit of other is set here.
contains_any
contains_any[[nodiscard]] constexpr bool contains_any(
const component_mask &other) const noexcept;True when at least one bit of other is set here.
for_each_set
for_each_settemplate <typename Callable> constexpr void for_each_set(
Callable &&callable) const;Invokes callable(component_id) for every set bit in ascending id order.
hash
hash[[nodiscard]] u64 hash() const noexcept;FNV-1a 64 over the words; equal masks hash equal on every platform.
none
none[[nodiscard]] constexpr bool none() const noexcept;True when no bit is set.
set
setconstexpr void set(
component_id id) noexcept;Sets the bit of id. Invalid ids assert and are ignored.
test
test[[nodiscard]] constexpr bool test(
component_id id) const noexcept;True when the bit of id is set; false for an invalid id.
words
words[[nodiscard]] constexpr const std::array<u64, WORD_COUNT> &words() const noexcept;The raw words, lowest ids first.
Operator Overloads
Public
operator&
operator&[[nodiscard]] constexpr component_mask operator&(
const component_mask &other) const noexcept;operator&=
operator&=constexpr component_mask &operator&=(
const component_mask &other) noexcept;operator==
operator==[[nodiscard]] constexpr bool operator==(
const component_mask &other) const noexcept = default;operator|
operator|[[nodiscard]] constexpr component_mask operator|(
const component_mask &other) const noexcept;operator|=
operator|=constexpr component_mask &operator|=(
const component_mask &other) noexcept;