8#ifndef RTYPE_REGISTRY_HPP_
9 #define RTYPE_REGISTRY_HPP_
26 #include <shared_mutex>
30 #include <type_traits>
31 #include <unordered_map>
37 template <
typename From,
typename To>
39 std::conditional_t<std::is_const_v<std::remove_reference_t<From>>,
40 std::add_const_t<To>, To>;
42 template <
typename From,
typename To>
69 auto
get(this const Self &self)
81 void clear(
void) noexcept;
83 void purge(
void) noexcept;
87 auto
view(this Self &self);
102 std::unordered_map<
std::type_index,
125#include "Registry.tpp"
Concepts for validating component types in the ECS.
Entity identifier for ECS architecture.
Error handling system with categorized error codes.
Logger declaration with support for multiple log levels.
Sparse array container for efficient component storage in ECS.
Comprehensive error object with severity and retry tracking.
Represents an entity in the ECS (Entity-Component-System) architecture.
Type-erased base interface for sparse arrays.
bool has(Entity entity) const noexcept
bool hasAllComponents(Entity entity) const noexcept
auto spawn(void) -> std::expected< Entity, rtp::Error >
std::size_t entityCount(void) const noexcept
auto subscribe(this Self &self) -> std::expected< std::reference_wrapper< ConstLike< Self, SparseArray< T > > >, rtp::Error >
std::deque< std::size_t > _freeIndices
Recyclable entity indices.
auto getArray(this Self &self) -> ConstLikeRef< Self, SparseArray< T > >
std::unordered_map< std::type_index, std::unique_ptr< ISparseArray > > _arrays
Registered component arrays.
std::size_t componentCount(void) const noexcept
std::vector< std::uint32_t > _generations
Generation counters for entities.
auto view(this Self &self)
void clear(void) noexcept
auto & getSmallestArray(this Self &self)
std::shared_mutex _mutex
Mutex for thread-safe operations.
bool isAlive(Entity entity) const noexcept
auto add(Entity entity, Args &&...args) -> std::expected< std::reference_wrapper< T >, rtp::Error >
auto get(this const Self &self) -> std::expected< std::reference_wrapper< ConstLike< Self, SparseArray< T > > >, rtp::Error >
void purge(void) noexcept
auto zipView(this Self &self)
void remove(Entity entity) noexcept
~Registry() noexcept=default
Sparse array container for component storage.
Concept for valid ECS component types.
File : RenderSystem.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias-josue....
std::conditional_t< std::is_const_v< std::remove_reference_t< From > >, std::add_const_t< To >, To > ConstLike
ConstLike< From, To > & ConstLikeRef