2#ifndef LIBSBX_ENTITY_HPP_
3#define LIBSBX_ENTITY_HPP_
10#include <libsbx/memory/concepts.hpp>
19template<
typename Type>
27 using value_type = std::uint32_t;
29 using entity_type = std::uint32_t;
30 using version_type = std::uint16_t;
32 inline static constexpr auto entity_mask = entity_type{0xFFFFF};
33 inline static constexpr auto version_mask = entity_type{0xFFF};
41 using value_type = std::uint64_t;
43 using entity_type = std::uint64_t;
44 using version_type = std::uint32_t;
46 inline static constexpr auto entity_mask = entity_type{0xFFFFFFFF};
47 inline static constexpr auto version_mask = entity_type{0xFFFFFFFF};
55template<
typename Type>
56requires (std::is_enum_v<Type>)
58 using value_type = Type;
61template<
typename Type>
62requires (std::is_class_v<Type>)
64 using value_type = Type;
72template<
typename Type>
81 inline static constexpr auto version_shift = std::popcount(entity_mask);
83 inline static constexpr auto page_size = std::size_t{4096};
85 static constexpr auto to_integral(
const value_type value)
noexcept -> entity_type;
87 static constexpr auto to_entity(
const value_type value)
noexcept -> entity_type;
89 static constexpr auto to_version(
const value_type value)
noexcept -> version_type;
91 static constexpr auto next(
const value_type value)
noexcept -> value_type;
93 static constexpr auto construct(
const entity_type entity,
const version_type version = version_type{0})
noexcept -> value_type;
95 static constexpr auto combine(
const entity_type lhs,
const entity_type rhs)
noexcept -> value_type;
99enum class entity : std::uint32_t { };
103 template<
typename Entity>
104 [[nodiscard]]
constexpr operator Entity()
const noexcept;
106 [[nodiscard]]
constexpr auto operator==([[maybe_unused]]
const basic_null_entity other)
const noexcept -> bool;
108 template<
typename Entity>
109 [[nodiscard]]
constexpr bool operator==(
const Entity entity)
const noexcept;
117 template<
typename Entity>
118 [[nodiscard]]
constexpr operator Entity()
const noexcept;
120 [[nodiscard]]
constexpr auto operator==([[maybe_unused]]
const basic_tombstone_entity other)
const noexcept -> bool;
122 template<
typename Entity>
123 [[nodiscard]]
constexpr bool operator==(
const Entity entity)
const noexcept;
131#include <libsbx/ecs/entity.ipp>
Primary template.
Definition: entity.hpp:20
Definition: entity.hpp:101
Definition: entity.hpp:115
Entity traits.
Definition: entity.hpp:73