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

Thread-safe read-only view into the world. More...

#include <world_view.hpp>

Public Member Functions

constexpr WorldView (const World &world) noexcept
 Constructs a WorldView from a World reference.
 WorldView (const WorldView &)=delete
 WorldView (WorldView &&)=delete
constexpr ~WorldView () noexcept=default
WorldViewoperator= (const WorldView &)=delete
WorldViewoperator= (WorldView &&)=delete
bool EntityExists (Entity entity) const noexcept
 Checks if entity exists in the world.
template<ComponentTrait T>
bool HasComponent (Entity entity) const
 Checks if entity has component.
template<ComponentTrait... Ts>
requires utils::UniqueTypes<Ts...> && (sizeof...(Ts) > 0)
auto HasComponents (Entity entity) const -> std::array< bool, sizeof...(Ts)>
 Checks if entity has components.
template<ResourceTrait T>
bool HasResource () const
 Checks if a resource exists.
template<AnyMessageTrait T>
bool HasMessage () const noexcept
 Checks if a message type is registered.
template<AnyMessageTrait T>
bool HasMessages () const noexcept
 Checks if messages of a specific type exist in message queue.
size_t EntityCount () const noexcept
 Gets the number of entities in the world.
size_t ResourceCount () const noexcept
 Gets the number of resources in the world.

Detailed Description

Thread-safe read-only view into the world.

Provides read-only introspection methods for entity, component, resource, and message queries. All operations are thread-safe for read access.

Note
Thread-safe for read operations.

Definition at line 25 of file world_view.hpp.

Constructor & Destructor Documentation

◆ WorldView() [1/3]

helios::ecs::WorldView::WorldView ( const World & world)
inlineexplicitconstexprnoexcept

Constructs a WorldView from a World reference.

Parameters
worldReference to the World to view.

Definition at line 31 of file world_view.hpp.

◆ WorldView() [2/3]

helios::ecs::WorldView::WorldView ( const WorldView & )
delete

◆ WorldView() [3/3]

helios::ecs::WorldView::WorldView ( WorldView && )
delete

◆ ~WorldView()

helios::ecs::WorldView::~WorldView ( )
constexprdefaultnoexcept

Member Function Documentation

◆ EntityCount()

size_t helios::ecs::WorldView::EntityCount ( ) const
inlinenodiscardnoexcept

Gets the number of entities in the world.

Note
Thread-safe.
Returns
Number of entities in the world

Definition at line 116 of file world_view.hpp.

◆ EntityExists()

bool helios::ecs::WorldView::EntityExists ( Entity entity) const
inlinenodiscardnoexcept

Checks if entity exists in the world.

Note
Thread-safe.
Warning
Triggers assertion in next cases:
Parameters
entityEntity to check
Returns
True if entity exists, false otherwise

Definition at line 133 of file world_view.hpp.

◆ HasComponent()

template<ComponentTrait T>
bool helios::ecs::WorldView::HasComponent ( Entity entity) const
inlinenodiscard

Checks if entity has component.

Note
Thread-safe.
Warning
Triggers assertion in next cases:
Template Parameters
TComponent type to check
Parameters
entityEntity to check
Returns
True if entity has the component

Definition at line 142 of file world_view.hpp.

◆ HasComponents()

template<ComponentTrait... Ts>
requires utils::UniqueTypes<Ts...> && (sizeof...(Ts) > 0)
auto helios::ecs::WorldView::HasComponents ( Entity entity) const -> std::array< bool, sizeof...(Ts)>
inlinenodiscard

Checks if entity has components.

Note
Thread-safe.
Warning
Triggers assertion in next cases:
Template Parameters
TsComponents types
Parameters
entityEntity to check
Returns
Array of bools indicating whether entity has each component

Definition at line 152 of file world_view.hpp.

◆ HasMessage()

template<AnyMessageTrait T>
bool helios::ecs::WorldView::HasMessage ( ) const
inlinenodiscardnoexcept

Checks if a message type is registered.

Note
Thread-safe.
Template Parameters
TMessage type
Returns
True if message type is registered, false otherwise

Definition at line 96 of file world_view.hpp.

◆ HasMessages()

template<AnyMessageTrait T>
bool helios::ecs::WorldView::HasMessages ( ) const
inlinenodiscardnoexcept

Checks if messages of a specific type exist in message queue.

Note
Thread-safe.
Template Parameters
TMessage type
Returns
True if messages exist, false otherwise

Definition at line 107 of file world_view.hpp.

◆ HasResource()

template<ResourceTrait T>
bool helios::ecs::WorldView::HasResource ( ) const
inlinenodiscard

Checks if a resource exists.

Note
Thread-safe.
Template Parameters
TResource type
Returns
True if resource exists, false otherwise

Definition at line 85 of file world_view.hpp.

◆ operator=() [1/2]

WorldView & helios::ecs::WorldView::operator= ( const WorldView & )
delete

◆ operator=() [2/2]

WorldView & helios::ecs::WorldView::operator= ( WorldView && )
delete

◆ ResourceCount()

size_t helios::ecs::WorldView::ResourceCount ( ) const
inlinenodiscardnoexcept

Gets the number of resources in the world.

Note
Thread-safe.
Returns
Number of resources in the world

Definition at line 125 of file world_view.hpp.