Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::ecs Namespace Reference

Namespaces

namespace  details
 

Classes

class  BasicQuery
 
class  BasicQueryBuilder
 
class  BasicQueryWithEntity
 Wrapper for queries that include entity in iteration. More...
 
class  Command
 Base class for all commands to be executed in the world. More...
 
struct  ComponentTraits
 Component traits for optimization decisions. More...
 
class  ComponentTypeInfo
 Component type info for runtime operations. More...
 
class  Entity
 Unique identifier for entities with generation counter to handle recycling. More...
 
class  EntityCmdBuffer
 
struct  EntityDestroyedEvent
 Event emitted when an entity is destroyed. More...
 
struct  EntitySpawnedEvent
 Event emitted when an entity is spawned/created. More...
 
class  EventIterator
 Iterator wrapper for EventReader. More...
 
class  EventReader
 
class  EventSimpleIterator
 Simple iterator for EventReader that returns plain events. More...
 
class  EventWriter
 Type-safe writer for events. More...
 
struct  IsConstComponent
 Helper to detect const components. More...
 
struct  IsConstComponent< const T >
 
struct  ShutdownEvent
 
class  System
 
class  World
 The World class manages entities with their components and systems. More...
 
class  WorldCmdBuffer
 

Concepts

concept  CommandTrait
 
concept  ConstComponentTrait
 Concept for const-qualified component types.
 
concept  ComponentTrait
 Concept to check if a type can be used as a component.
 
concept  ComponentWithNameTrait
 Concept for components that provide a static name method.
 
concept  TagComponentTrait
 Concept for tag components (empty).
 
concept  TrivialComponentTrait
 Concept for trivially copyable components (POD-like).
 
concept  TinyComponentTrait
 Concept for tiny components (single cache line portion), where sizeof(T) <= 16.
 
concept  SmallComponentTrait
 Concept for small components that fit in cache line, where sizeof(T) <= 64.
 
concept  MediumComponentTrait
 Concept for medium components (multiple cache line portions), where 64 < sizeof(T) <= 256.
 
concept  LargeComponentTrait
 Concept for large components that don't fit in cache line, where sizeof(T) > 256.
 
concept  EventTrait
 Concept for valid event types.
 
concept  EventWithNameTrait
 Concept for events with custom names.
 
concept  EventWithClearPolicy
 Concept for events with custom clear policy.
 
concept  ResourceTrait
 Concept for valid resource types.
 
concept  ResourceWithNameTrait
 Concept for resources that provide custom names.
 
concept  ResourceWithThreadSafetyTrait
 Concept for resources that provide thread-safety trait.
 
concept  AtomicResourceTrait
 Concept for atomic resources that can be accessed concurrently.
 
concept  SystemTrait
 Concept for valid system types.
 
concept  SystemWithNameTrait
 Concept for systems with custom names.
 
concept  WorldType
 Concept that constrains a type to be the World type (with any cv-qualifiers).
 

Typedefs

using ComponentTypeId = size_t
 Type ID for components.
 
using EventTypeId = size_t
 Type ID for events.
 
template<typename Allocator = std::allocator<ComponentTypeId>>
using QueryBuilder = BasicQueryBuilder< World, Allocator >
 Type alias for query builder with mutable world access.
 
template<typename Allocator = std::allocator<ComponentTypeId>>
using ReadOnlyQueryBuilder = BasicQueryBuilder< const World, Allocator >
 Type alias for query builder with read-only world access.
 
template<typename Allocator , ComponentTrait... Components>
using Query = BasicQuery< World, Allocator, Components... >
 Type alias for query with mutable world access.
 
template<typename Allocator , ComponentTrait... Components>
using ReadOnlyQuery = BasicQuery< const World, Allocator, Components... >
 Type alias for query with read-only world access.
 
template<typename Allocator , ComponentTrait... Components>
using QueryWithEntity = BasicQueryWithEntity< World, Allocator, Components... >
 Type alias for query with entity with mutable world access.
 
template<typename Allocator , ComponentTrait... Components>
using ReadOnlyQueryWithEntity = BasicQueryWithEntity< const World, Allocator, Components... >
 Type alias for query with entity with read-only world access.
 
using ResourceTypeId = size_t
 Type ID for resources.
 
using SystemTypeId = size_t
 Type ID for systems.
 

Enumerations

enum class  EventClearPolicy : uint8_t { kAutomatic , kManual }
 Policy for event clearing behavior. More...
 
enum class  ShutdownExitCode : uint8_t { Success = 0 , Failure = 1 }
 Exit code for application shutdown. More...
 

Functions

template<ComponentTrait T>
constexpr ComponentTypeId ComponentTypeIdOf () noexcept
 Type ID for components using CTTI.
 
template<ComponentTrait T>
constexpr std::string_view ComponentNameOf () noexcept
 
template<EventTrait T>
constexpr EventTypeId EventTypeIdOf () noexcept
 Gets type ID for an event type.
 
template<EventTrait T>
constexpr std::string_view EventNameOf () noexcept
 Gets the name of an event.
 
template<EventTrait T>
constexpr EventClearPolicy EventClearPolicyOf () noexcept
 Gets the clear policy of an event.
 
template<WorldType WorldT>
 BasicQueryBuilder (WorldT &) -> BasicQueryBuilder< WorldT, std::allocator< ComponentTypeId > >
 
template<WorldType WorldT>
 BasicQueryBuilder (WorldT &, const app::AccessPolicy &) -> BasicQueryBuilder< WorldT, std::allocator< ComponentTypeId > >
 
template<WorldType WorldT, typename Allocator >
 BasicQueryBuilder (WorldT &, Allocator) -> BasicQueryBuilder< WorldT, Allocator >
 
template<WorldType WorldT, typename Allocator >
 BasicQueryBuilder (WorldT &, const app::AccessPolicy &, Allocator) -> BasicQueryBuilder< WorldT, Allocator >
 
template<ResourceTrait T>
constexpr ResourceTypeId ResourceTypeIdOf () noexcept
 Gets type ID for a resource type.
 
template<ResourceTrait T>
constexpr std::string_view ResourceNameOf () noexcept
 Gets name for a resource type.
 
template<ResourceTrait T>
constexpr bool IsResourceThreadSafe () noexcept
 Checks if a resource type is thread-safe.
 
template<typename T >
constexpr SystemTypeId SystemTypeIdOf () noexcept
 Gets type ID for a system type.
 
template<SystemTrait T>
constexpr std::string_view SystemNameOf () noexcept
 Gets the name of a system.
 

Variables

template<typename T >
constexpr bool IsConstComponent_v = IsConstComponent<T>::value
 

Typedef Documentation

◆ ComponentTypeId

◆ EventTypeId

Type ID for events.

Definition at line 18 of file event.hpp.

◆ Query

◆ QueryBuilder

template<typename Allocator = std::allocator<ComponentTypeId>>
using helios::ecs::QueryBuilder = typedef BasicQueryBuilder<World, Allocator>

Type alias for query builder with mutable world access.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/query.hpp.

Definition at line 2473 of file query.hpp.

◆ QueryWithEntity

template<typename Allocator , ComponentTrait... Components>
using helios::ecs::QueryWithEntity = typedef BasicQueryWithEntity<World, Allocator, Components...>

Type alias for query with entity with mutable world access.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/query.hpp.

Definition at line 2489 of file query.hpp.

◆ ReadOnlyQuery

template<typename Allocator , ComponentTrait... Components>
using helios::ecs::ReadOnlyQuery = typedef BasicQuery<const World, Allocator, Components...>

Type alias for query with read-only world access.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/query.hpp.

Definition at line 2485 of file query.hpp.

◆ ReadOnlyQueryBuilder

template<typename Allocator = std::allocator<ComponentTypeId>>
using helios::ecs::ReadOnlyQueryBuilder = typedef BasicQueryBuilder<const World, Allocator>

Type alias for query builder with read-only world access.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/query.hpp.

Definition at line 2477 of file query.hpp.

◆ ReadOnlyQueryWithEntity

template<typename Allocator , ComponentTrait... Components>
using helios::ecs::ReadOnlyQueryWithEntity = typedef BasicQueryWithEntity<const World, Allocator, Components...>

Type alias for query with entity with read-only world access.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/query.hpp.

Definition at line 2493 of file query.hpp.

◆ ResourceTypeId

◆ SystemTypeId

Enumeration Type Documentation

◆ EventClearPolicy

Policy for event clearing behavior.

Enumerator
kAutomatic 

Events are automatically cleared after double buffer cycle.

kManual 

Events persist until manually cleared via ManualClear()

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/events/builtin_events.hpp.

Definition at line 23 of file event.hpp.

23 : uint8_t {
24 kAutomatic, ///< Events are automatically cleared after double buffer cycle
25 kManual ///< Events persist until manually cleared via ManualClear()
26};
@ kAutomatic
Events are automatically cleared after double buffer cycle.
@ kManual
Events persist until manually cleared via ManualClear()

◆ ShutdownExitCode

Exit code for application shutdown.

Enumerator
Success 

Normal shutdown.

Failure 

Shutdown due to error.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp, and /home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/events/builtin_events.hpp.

Definition at line 60 of file builtin_events.hpp.

60 : uint8_t {
61 Success = 0, ///< Normal shutdown
62 Failure = 1, ///< Shutdown due to error
63};

Function Documentation

◆ BasicQueryBuilder() [1/4]

template<WorldType WorldT>
helios::ecs::BasicQueryBuilder ( WorldT ) -> BasicQueryBuilder< WorldT, std::allocator< ComponentTypeId > >

◆ BasicQueryBuilder() [2/4]

template<WorldType WorldT, typename Allocator >
helios::ecs::BasicQueryBuilder ( WorldT ,
Allocator   
) -> BasicQueryBuilder< WorldT, Allocator >

◆ BasicQueryBuilder() [3/4]

template<WorldType WorldT>
helios::ecs::BasicQueryBuilder ( WorldT ,
const app::AccessPolicy  
) -> BasicQueryBuilder< WorldT, std::allocator< ComponentTypeId > >

◆ BasicQueryBuilder() [4/4]

template<WorldType WorldT, typename Allocator >
helios::ecs::BasicQueryBuilder ( WorldT ,
const app::AccessPolicy ,
Allocator   
) -> BasicQueryBuilder< WorldT, Allocator >

◆ ComponentNameOf()

template<ComponentTrait T>
constexpr std::string_view helios::ecs::ComponentNameOf ( )
constexprnoexcept

Definition at line 117 of file component.hpp.

117 {
118 if constexpr (ComponentWithNameTrait<T>) {
119 return T::GetName();
120 } else {
121 return ctti::name_of<T>();
122 }
123}
Concept for components that provide a static name method.
Definition component.hpp:46

◆ ComponentTypeIdOf()

template<ComponentTrait T>
constexpr ComponentTypeId helios::ecs::ComponentTypeIdOf ( )
constexprnoexcept

Type ID for components using CTTI.

Template Parameters
TComponent type
Returns
Unique type ID for the component
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/query.hpp.

Definition at line 112 of file component.hpp.

112 {
113 return ctti::type_index_of<T>().hash();
114}

◆ EventClearPolicyOf()

template<EventTrait T>
constexpr EventClearPolicy helios::ecs::EventClearPolicyOf ( )
constexprnoexcept

Gets the clear policy of an event.

Returns provided policy or kAutomatic as default.

Template Parameters
TEvent type
Returns
Event clear policy

Definition at line 98 of file event.hpp.

98 {
99 if constexpr (EventWithClearPolicy<T>) {
100 return T::GetClearPolicy();
101 } else {
102 return EventClearPolicy::kAutomatic;
103 }
104}
Concept for events with custom clear policy.
Definition event.hpp:62

◆ EventNameOf()

template<EventTrait T>
constexpr std::string_view helios::ecs::EventNameOf ( )
constexprnoexcept

Gets the name of an event.

Returns provided name or type name as fallback.

Template Parameters
TEvent type
Returns
Event name

Definition at line 83 of file event.hpp.

83 {
84 if constexpr (EventWithNameTrait<T>) {
85 return T::GetName();
86 } else {
87 return ctti::name_of<T>();
88 }
89}
Concept for events with custom names.
Definition event.hpp:52

◆ EventTypeIdOf()

template<EventTrait T>
constexpr EventTypeId helios::ecs::EventTypeIdOf ( )
constexprnoexcept

Gets type ID for an event type.

Template Parameters
TEvent type
Returns
Unique type ID for the event

Definition at line 72 of file event.hpp.

72 {
73 return ctti::type_index_of<T>().hash();
74}

◆ IsResourceThreadSafe()

template<ResourceTrait T>
constexpr bool helios::ecs::IsResourceThreadSafe ( )
constexprnoexcept

Checks if a resource type is thread-safe.

Template Parameters
TResource type
Returns
True if resource is thread-safe, false otherwise

Definition at line 85 of file resource.hpp.

85 {
87 return T::ThreadSafe();
88 } else {
89 return false;
90 }
91}
Concept for resources that provide thread-safety trait.
Definition resource.hpp:39

◆ ResourceNameOf()

template<ResourceTrait T>
constexpr std::string_view helios::ecs::ResourceNameOf ( )
constexprnoexcept

Gets name for a resource type.

Template Parameters
TResource type
Returns
Name of the resource

Definition at line 71 of file resource.hpp.

71 {
72 if constexpr (ResourceWithNameTrait<T>) {
73 return T::GetName();
74 } else {
75 return ctti::name_of<T>();
76 }
77}
Concept for resources that provide custom names.
Definition resource.hpp:29

◆ ResourceTypeIdOf()

template<ResourceTrait T>
constexpr ResourceTypeId helios::ecs::ResourceTypeIdOf ( )
constexprnoexcept

Gets type ID for a resource type.

Template Parameters
TResource type
Returns
Unique type ID for the resource

Definition at line 61 of file resource.hpp.

61 {
62 return ctti::type_index_of<T>().hash();
63}

◆ SystemNameOf()

template<SystemTrait T>
constexpr std::string_view helios::ecs::SystemNameOf ( )
constexprnoexcept

Gets the name of a system.

Returns provided name or type name as fallback.

Template Parameters
TSystem type
Returns
System name
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/system.hpp.

Definition at line 112 of file system.hpp.

112 {
113 if constexpr (SystemWithNameTrait<T>) {
114 return T::GetName();
115 } else {
116 return ctti::name_of<T>();
117 }
118}
Concept for systems with custom names.
Definition system.hpp:86

◆ SystemTypeIdOf()

template<typename T >
constexpr SystemTypeId helios::ecs::SystemTypeIdOf ( )
constexprnoexcept

Gets type ID for a system type.

Template Parameters
TSystem type
Returns
Unique type ID for the system
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/system.hpp.

Definition at line 101 of file system.hpp.

101 {
102 return ctti::type_index_of<T>().hash();
103}

Variable Documentation

◆ IsConstComponent_v

template<typename T >
constexpr bool helios::ecs::IsConstComponent_v = IsConstComponent<T>::value
inlineconstexpr

Definition at line 26 of file component.hpp.