Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args > Class Template Reference

Wrapper that provides entity-aware iteration over query results. More...

#include <query.hpp>

Public Types

using iterator = typename TypeInfo::template WithEntityIterator<kIsConst>
using const_iterator = typename TypeInfo::template WithEntityIterator<true>
using value_type = std::iter_value_t<iterator>
using difference_type = std::iter_difference_t<iterator>
using pointer = typename iterator::pointer
using reference = std::iter_reference_t<iterator>
using allocator_type = Allocator

Public Member Functions

 BasicQueryWithEntity (BasicQuery< WorldT, Allocator, Args... > &query) noexcept
 Constructs entity-aware query wrapper.
 BasicQueryWithEntity (const BasicQueryWithEntity &)=delete
 BasicQueryWithEntity (BasicQueryWithEntity &&)=delete
 ~BasicQueryWithEntity () noexcept=default
BasicQueryWithEntityoperator= (const BasicQueryWithEntity &)=delete
BasicQueryWithEntityoperator= (BasicQueryWithEntity &&)=delete
auto Get (Entity entity) const -> value_type
 Gets all query components for a specific entity (ignores query filters).
auto TryGet (Entity entity) const -> std::optional< value_type >
 Tries to get all query components for a specific entity (ignores query filters).
auto TryGetFiltered (Entity entity) const -> std::optional< value_type >
 Tries to get all query components for a specific entity while respecting query filters.
auto Collect () const -> std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
 Collects all results into a vector.
template<typename ResultAlloc>
requires std::same_as<typename ResultAlloc::value_type, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type> &&
(!std::derived_from<std::remove_pointer_t<ResultAlloc>, std::pmr::memory_resource>)
auto CollectWith (ResultAlloc alloc) const -> std::vector< value_type, ResultAlloc >
 Collects all results into a vector using a custom allocator.
auto CollectWith (std::pmr::memory_resource *resource) const -> std::pmr::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
 Collects all results using a memory resource.
auto CollectWith (std::nullptr_t) const -> std::pmr::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >=delete
auto CollectEntities () const -> std::vector< Entity >
 Collects all matching entities into a vector.
template<typename ResultAlloc>
requires std::same_as<typename ResultAlloc::value_type, Entity> && (!std::derived_from<std::remove_pointer_t<ResultAlloc>,
std::pmr::memory_resource>)
auto CollectEntitiesWith (ResultAlloc alloc) const -> std::vector< Entity, ResultAlloc >
 Collects all matching entities using a custom allocator.
auto CollectEntitiesWith (std::pmr::memory_resource *resource) const -> std::pmr::vector< Entity >
 Collects all matching entities using a memory resource.
auto CollectEntitiesWith (std::nullptr_t) const -> std::pmr::vector< Entity >=delete
template<typename OutIt>
requires std::output_iterator< OutIt, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
void Into (OutIt out)
 Writes all query results into an output iterator.
template<typename Action>
requires utils::ActionFor< Action, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
void ForEach (const Action &action) const
 Executes an action for each matching entity and components.
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto Filter (Pred predicate) const -> utils::FilterAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Pred >
 Filters entities based on a predicate.
template<typename Func>
requires utils::TransformFor< Func, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto Map (Func transform) const -> utils::MapAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Func >
 Transforms each element using a mapping function.
auto Take (size_t count) const -> utils::TakeAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator >
 Takes only the first N elements.
auto Skip (size_t count) const -> utils::SkipAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator >
 Skips the first N elements.
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto TakeWhile (Pred predicate) const -> utils::TakeWhileAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Pred >
 Takes elements while a predicate is true.
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto SkipWhile (Pred predicate) const -> utils::SkipWhileAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Pred >
 Skips elements while a predicate is true.
auto Enumerate () const -> utils::EnumerateAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator >
 Adds an index to each element.
template<typename Func>
requires utils::InspectorFor< Func, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto Inspect (Func inspector) const -> utils::InspectAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Func >
 Inspects each element without consuming it.
auto StepBy (size_t step) const -> utils::StepByAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator >
 Yields every Nth element.
template<typename OtherIter>
requires utils::ChainAdapterRequirements<iterator, OtherIter>
auto Chain (OtherIter other_begin, OtherIter other_end) const -> utils::ChainAdapter< iterator, OtherIter >
 Chains this query with another iterator range.
auto Chain (const BasicQueryWithEntity &other) const -> utils::ChainAdapter< iterator, iterator >
 Chains this query with another query of the same type.
template<std::ranges::input_range R>
requires utils::ChainAdapterRequirements<iterator, std::ranges::iterator_t<R>>
auto Chain (R &range) const -> utils::ChainAdapter< iterator, std::ranges::iterator_t< R > >
 Chains this query with another range.
template<std::ranges::input_range R>
requires utils::ChainAdapterRequirements<iterator, std::ranges::iterator_t<const R>>
auto Chain (const R &range) const -> utils::ChainAdapter< iterator, std::ranges::iterator_t< const R > >
 Chains this query with another const range.
auto Reverse () const -> utils::ReverseAdapter< iterator >
 Reverses the order of iteration.
auto Slide (size_t window_size) const -> utils::SlideAdapter< iterator >
 Creates sliding windows over query results.
auto Stride (size_t stride) const -> utils::StrideAdapter< iterator >
 Takes every Nth element with stride.
template<typename OtherIter>
requires utils::ZipAdapterRequirements<iterator, OtherIter>
auto Zip (OtherIter other_begin, OtherIter other_end) const -> utils::ZipAdapter< iterator, OtherIter >
 Zips this query with another iterator range.
auto Zip (const BasicQueryWithEntity &other) const -> utils::ZipAdapter< iterator, iterator >
 Zips this query with another query of the same type.
template<std::ranges::input_range R>
requires utils::ZipAdapterRequirements<iterator, std::ranges::iterator_t<R>>
auto Zip (R &range) const -> utils::ZipAdapter< iterator, std::ranges::iterator_t< R > >
 Zips this query with another range.
template<std::ranges::input_range R>
requires utils::ZipAdapterRequirements<iterator, std::ranges::iterator_t<const R>>
auto Zip (const R &range) const -> utils::ZipAdapter< iterator, std::ranges::iterator_t< const R > >
 Zips this query with another const range.
template<typename T, typename Func>
requires utils::FolderFor< Func, T, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
Fold (T init, const Func &folder) const
 Folds query results into a single value.
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto Find (const Pred &predicate) const -> std::optional< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
 Finds the first result matching a predicate.
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
size_t CountIf (const Pred &predicate) const
 Counts entities matching a predicate.
template<typename KeyFunc>
requires utils::TransformFor< KeyFunc, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto MaxBy (const KeyFunc &key_func) const -> std::optional< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
 Finds the element with the maximum key value.
template<typename KeyFunc>
requires utils::TransformFor< KeyFunc, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto MinBy (const KeyFunc &key_func) const -> std::optional< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
 Finds the element with the minimum key value.
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto Partition (const Pred &predicate) const -> std::pair< std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >, std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type > >
 Partitions results into two groups based on a predicate.
template<typename KeyExtractor>
requires utils::TransformFor< KeyExtractor, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto GroupBy (const KeyExtractor &key_extractor) const -> std::unordered_map< std::decay_t< utils::details::call_or_apply_result_t< const KeyExtractor &, typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type > >, std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type > >
 Groups results by an extracted key.
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
bool Any (const Pred &predicate) const
 Checks if any entity matches the predicate.
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
bool All (const Pred &predicate) const
 Checks if all entities match the predicate.
template<typename Pred>
requires utils::PredicateFor<Pred, value_type>
bool None (const Pred &predicate) const
 Checks if no entities match the predicate.
bool Empty () const noexcept
 Checks if query matches no entities.
size_t Count () const noexcept
 Gets the number of matching entities.
iterator begin () const
 Gets iterator to first matching entity and components.
iterator end () const noexcept
 Gets iterator past the last matching entity and components.
template<typename ResultAlloc>
requires std::same_as<typename ResultAlloc::value_type, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type> &&
(!std::derived_from<std::remove_pointer_t<ResultAlloc>, std::pmr::memory_resource>)
auto CollectWith (ResultAlloc alloc) const -> std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type, ResultAlloc >

Detailed Description

template<typename WorldT, typename Allocator, QueryArg... Args>
class helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >

Wrapper that provides entity-aware iteration over query results.

Each dereferenced value is a tuple starting with the Entity, followed by the requested component access values.

This wrapper is lightweight and holds a reference to the underlying BasicQuery. It must not outlive the query it wraps.

Note
Not thread-safe.
Template Parameters
WorldTWorld type (World or const World)
AllocatorAllocator type for internal storage
ArgsComponent access types and optional With/Without filters

Definition at line 80 of file query.hpp.

Member Typedef Documentation

◆ allocator_type

template<typename WorldT, typename Allocator, QueryArg... Args>
using helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::allocator_type = Allocator

Definition at line 93 of file query.hpp.

◆ const_iterator

template<typename WorldT, typename Allocator, QueryArg... Args>
using helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::const_iterator = typename TypeInfo::template WithEntityIterator<true>

Definition at line 88 of file query.hpp.

◆ difference_type

template<typename WorldT, typename Allocator, QueryArg... Args>
using helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::difference_type = std::iter_difference_t<iterator>

Definition at line 90 of file query.hpp.

◆ iterator

template<typename WorldT, typename Allocator, QueryArg... Args>
using helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::iterator = typename TypeInfo::template WithEntityIterator<kIsConst>

Definition at line 87 of file query.hpp.

◆ pointer

template<typename WorldT, typename Allocator, QueryArg... Args>
using helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::pointer = typename iterator::pointer

Definition at line 91 of file query.hpp.

◆ reference

template<typename WorldT, typename Allocator, QueryArg... Args>
using helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::reference = std::iter_reference_t<iterator>

Definition at line 92 of file query.hpp.

◆ value_type

template<typename WorldT, typename Allocator, QueryArg... Args>
using helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::value_type = std::iter_value_t<iterator>

Definition at line 89 of file query.hpp.

Constructor & Destructor Documentation

◆ BasicQueryWithEntity() [1/3]

template<typename WorldT, typename Allocator, QueryArg... Args>
helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::BasicQueryWithEntity ( BasicQuery< WorldT, Allocator, Args... > & query)
inlineexplicitnoexcept

Constructs entity-aware query wrapper.

Parameters
queryReference to the underlying query

Definition at line 99 of file query.hpp.

◆ BasicQueryWithEntity() [2/3]

template<typename WorldT, typename Allocator, QueryArg... Args>
helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::BasicQueryWithEntity ( const BasicQueryWithEntity< WorldT, Allocator, Args > & )
delete

◆ BasicQueryWithEntity() [3/3]

template<typename WorldT, typename Allocator, QueryArg... Args>
helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::BasicQueryWithEntity ( BasicQueryWithEntity< WorldT, Allocator, Args > && )
delete

◆ ~BasicQueryWithEntity()

template<typename WorldT, typename Allocator, QueryArg... Args>
helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::~BasicQueryWithEntity ( )
defaultnoexcept

Member Function Documentation

◆ All()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
bool helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::All ( const Pred & predicate) const
inlinenodiscard

Checks if all entities match the predicate.

Template Parameters
PredPredicate type
Parameters
predicateFunction to test each result
Returns
True if all results match

Definition at line 2089 of file query.hpp.

◆ Any()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
bool helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Any ( const Pred & predicate) const
inlinenodiscard

Checks if any entity matches the predicate.

Template Parameters
PredPredicate type
Parameters
predicateFunction to test each result
Returns
True if at least one result matches

Definition at line 2079 of file query.hpp.

◆ begin()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::begin ( ) const
inlinenodiscard

Gets iterator to first matching entity and components.

Returns
Iterator to the beginning of the query results

Definition at line 2207 of file query.hpp.

◆ Chain() [1/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Chain ( const BasicQueryWithEntity< WorldT, Allocator, Args > & other) const -> utils::ChainAdapter< iterator, iterator >
inlinenodiscard

Chains this query with another query of the same type.

Parameters
otherOther query to chain after this one
Returns
Lazy chain view

Definition at line 348 of file query.hpp.

◆ Chain() [2/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
template<std::ranges::input_range R>
requires utils::ChainAdapterRequirements<iterator, std::ranges::iterator_t<const R>>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Chain ( const R & range) const -> utils::ChainAdapter< iterator, std::ranges::iterator_t< const R > >
inlinenodiscard

Chains this query with another const range.

Template Parameters
RRange type
Parameters
rangeRange to chain after this query
Returns
Lazy chain view

Definition at line 376 of file query.hpp.

◆ Chain() [3/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
template<typename OtherIter>
requires utils::ChainAdapterRequirements<iterator, OtherIter>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Chain ( OtherIter other_begin,
OtherIter other_end ) const -> utils::ChainAdapter< iterator, OtherIter >
inlinenodiscard

Chains this query with another iterator range.

Template Parameters
OtherIterIterator type of the second range
Parameters
other_beginBegin iterator of the second range
other_endEnd iterator of the second range
Returns
Lazy chain view

Definition at line 338 of file query.hpp.

◆ Chain() [4/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
template<std::ranges::input_range R>
requires utils::ChainAdapterRequirements<iterator, std::ranges::iterator_t<R>>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Chain ( R & range) const -> utils::ChainAdapter< iterator, std::ranges::iterator_t< R > >
inlinenodiscard

Chains this query with another range.

Template Parameters
RRange type
Parameters
rangeRange to chain after this query
Returns
Lazy chain view

Definition at line 362 of file query.hpp.

◆ Collect()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Collect ( ) const -> std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
inlinenodiscard

Collects all results into a vector.

Returns
Vector of tuples containing entity and components

Definition at line 1817 of file query.hpp.

◆ CollectEntities()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CollectEntities ( ) const -> std::vector< Entity >
inlinenodiscard

Collects all matching entities into a vector.

Returns
Vector of Entity objects

Definition at line 1862 of file query.hpp.

◆ CollectEntitiesWith() [1/3]

template<typename WorldT, typename Allocator, QueryArg... Args>
requires std::same_as<typename ResultAlloc::value_type, Entity> && (!std::derived_from<std::remove_pointer_t<ResultAlloc>,
std::pmr::memory_resource>)
template<typename ResultAlloc>
requires std::same_as<typename ResultAlloc::value_type, Entity> && (!std::derived_from<std::remove_pointer_t<ResultAlloc>,
std::pmr::memory_resource>)
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CollectEntitiesWith ( ResultAlloc alloc) const -> std::vector< Entity, ResultAlloc >
inlinenodiscard

Collects all matching entities using a custom allocator.

Template Parameters
ResultAllocSTL-compatible allocator type for Entity
Parameters
allocAllocator instance
Returns
Vector of entities using the provided allocator

Definition at line 1878 of file query.hpp.

◆ CollectEntitiesWith() [2/3]

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CollectEntitiesWith ( std::nullptr_t ) const -> std::pmr::vector< Entity >=delete
delete

◆ CollectEntitiesWith() [3/3]

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CollectEntitiesWith ( std::pmr::memory_resource * resource) const -> std::pmr::vector< Entity >
inlinenodiscard

Collects all matching entities using a memory resource.

Parameters
resourceMemory resource
Returns
Vector of results using provided allocator

Definition at line 1890 of file query.hpp.

◆ CollectWith() [1/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
template<typename ResultAlloc>
requires std::same_as<typename ResultAlloc::value_type, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type> &&
(!std::derived_from<std::remove_pointer_t<ResultAlloc>, std::pmr::memory_resource>)
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CollectWith ( ResultAlloc alloc) const -> std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type, ResultAlloc >
inline

Definition at line 1835 of file query.hpp.

◆ CollectWith() [2/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
template<typename ResultAlloc>
requires std::same_as<typename ResultAlloc::value_type, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type> &&
(!std::derived_from<std::remove_pointer_t<ResultAlloc>, std::pmr::memory_resource>)
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CollectWith ( ResultAlloc alloc) const -> std::vector< value_type, ResultAlloc >
nodiscard

Collects all results into a vector using a custom allocator.

Template Parameters
ResultAllocSTL-compatible allocator type for value_type
Parameters
allocAllocator instance to use
Returns
Vector of results using the provided allocator

◆ CollectWith() [3/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CollectWith ( std::nullptr_t ) const -> std::pmr::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >=delete
delete

◆ CollectWith() [4/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CollectWith ( std::pmr::memory_resource * resource) const -> std::pmr::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
inlinenodiscard

Collects all results using a memory resource.

Parameters
resourceMemory resource
Returns
Vector of results using provided allocator

Definition at line 1849 of file query.hpp.

◆ Count()

template<typename WorldT, typename Allocator, QueryArg... Args>
size_t helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Count ( ) const
inlinenodiscardnoexcept

Gets the number of matching entities.

Returns
Total count of entities matching the query

Definition at line 609 of file query.hpp.

◆ CountIf()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
size_t helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::CountIf ( const Pred & predicate) const
inlinenodiscard

Counts entities matching a predicate.

Template Parameters
PredPredicate type
Parameters
predicateFunction to test each result
Returns
Number of matching entities

Definition at line 2122 of file query.hpp.

◆ Empty()

template<typename WorldT, typename Allocator, QueryArg... Args>
bool helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Empty ( ) const
inlinenodiscardnoexcept

Checks if query matches no entities.

Returns
True if no entities match

Definition at line 603 of file query.hpp.

◆ end()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::end ( ) const
inlinenodiscardnoexcept

Gets iterator past the last matching entity and components.

Returns
Iterator to the end of the query results

Definition at line 2215 of file query.hpp.

◆ Enumerate()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Enumerate ( ) const -> utils::EnumerateAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator >
inlinenodiscard

Adds an index to each element.

Returns
Lazy enumerate view yielding (index, entity, components...) tuples

Definition at line 2029 of file query.hpp.

◆ Filter()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Filter ( Pred predicate) const -> utils::FilterAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Pred >
inlinenodiscard

Filters entities based on a predicate.

Template Parameters
PredPredicate function type
Parameters
predicateFunction to test each result
Returns
Lazy filter view

Definition at line 1931 of file query.hpp.

◆ Find()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Find ( const Pred & predicate) const -> std::optional< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
inlinenodiscard

Finds the first result matching a predicate.

Template Parameters
PredPredicate type
Parameters
predicateFunction to test each result
Returns
First matching result, or std::nullopt if none found

Definition at line 2110 of file query.hpp.

◆ Fold()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::FolderFor< Func, T, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename T, typename Func>
requires utils::FolderFor< Func, T, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
T helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Fold ( T init,
const Func & folder ) const
inlinenodiscard

Folds query results into a single value.

Template Parameters
TAccumulator type
FuncFolder function type
Parameters
initInitial accumulator value
folderFunction combining accumulator with each result
Returns
Final accumulated value

Definition at line 2132 of file query.hpp.

◆ ForEach()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::ActionFor< Action, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Action>
requires utils::ActionFor< Action, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
void helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::ForEach ( const Action & action) const
inline

Executes an action for each matching entity and components.

Template Parameters
ActionFunction type (Entity, Components...) -> void
Parameters
actionFunction to execute for each result

Definition at line 1915 of file query.hpp.

◆ Get()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Get ( Entity entity) const -> value_type
inlinenodiscard

Gets all query components for a specific entity (ignores query filters).

Parameters
entityThe entity to get components for
Returns
Tuple of component access types for the entity

Definition at line 116 of file query.hpp.

◆ GroupBy()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::TransformFor< KeyExtractor, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename KeyExtractor>
requires utils::TransformFor< KeyExtractor, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::GroupBy ( const KeyExtractor & key_extractor) const -> std::unordered_map< std::decay_t< utils::details::call_or_apply_result_t< const KeyExtractor &, typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type > >, std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type > >
inlinenodiscard

Groups results by an extracted key.

Template Parameters
KeyExtractorFunction type returning a hashable key
Parameters
key_extractorFunction that extracts the grouping key
Returns
Map from keys to vectors of results

Definition at line 2180 of file query.hpp.

◆ Inspect()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::InspectorFor< Func, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Func>
requires utils::InspectorFor< Func, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Inspect ( Func inspector) const -> utils::InspectAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Func >
inlinenodiscard

Inspects each element without consuming it.

Template Parameters
FuncInspection function type
Parameters
inspectorFunction to call on each result
Returns
Lazy inspect view

Definition at line 2046 of file query.hpp.

◆ Into()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires std::output_iterator< OutIt, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename OutIt>
requires std::output_iterator< OutIt, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
void helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Into ( OutIt out)
inline

Writes all query results into an output iterator.

Template Parameters
OutItOutput iterator type
Parameters
outOutput iterator

Definition at line 1905 of file query.hpp.

◆ Map()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::TransformFor< Func, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Func>
requires utils::TransformFor< Func, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Map ( Func transform) const -> utils::MapAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Func >
inlinenodiscard

Transforms each element using a mapping function.

Template Parameters
FuncTransformation function type
Parameters
transformFunction to transform each result
Returns
Lazy map view

Definition at line 1950 of file query.hpp.

◆ MaxBy()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::TransformFor< KeyFunc, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename KeyFunc>
requires utils::TransformFor< KeyFunc, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::MaxBy ( const KeyFunc & key_func) const -> std::optional< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
inlinenodiscard

Finds the element with the maximum key value.

Template Parameters
KeyFuncKey extraction function type
Parameters
key_funcFunction to extract comparison key
Returns
Element with maximum key, or std::nullopt if empty

Definition at line 2142 of file query.hpp.

◆ MinBy()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::TransformFor< KeyFunc, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename KeyFunc>
requires utils::TransformFor< KeyFunc, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::MinBy ( const KeyFunc & key_func) const -> std::optional< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >
inlinenodiscard

Finds the element with the minimum key value.

Template Parameters
KeyFuncKey extraction function type
Parameters
key_funcFunction to extract comparison key
Returns
Element with minimum key, or std::nullopt if empty

Definition at line 2154 of file query.hpp.

◆ None()

template<typename WorldT, typename Allocator, QueryArg... Args>
template<typename Pred>
requires utils::PredicateFor<Pred, value_type>
bool helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::None ( const Pred & predicate) const
inlinenodiscard

Checks if no entities match the predicate.

Template Parameters
PredPredicate type
Parameters
predicateFunction to test each result
Returns
True if no results match

Definition at line 595 of file query.hpp.

◆ operator=() [1/2]

template<typename WorldT, typename Allocator, QueryArg... Args>
BasicQueryWithEntity & helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::operator= ( BasicQueryWithEntity< WorldT, Allocator, Args > && )
delete

◆ operator=() [2/2]

template<typename WorldT, typename Allocator, QueryArg... Args>
BasicQueryWithEntity & helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::operator= ( const BasicQueryWithEntity< WorldT, Allocator, Args > & )
delete

◆ Partition()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Partition ( const Pred & predicate) const -> std::pair< std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type >, std::vector< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::value_type > >
inlinenodiscard

Partitions results into two groups based on a predicate.

Template Parameters
PredPredicate type
Parameters
predicateFunction to test each result
Returns
Pair of vectors: (matching results, non-matching results)

Definition at line 2166 of file query.hpp.

◆ Reverse()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Reverse ( ) const -> utils::ReverseAdapter< iterator >
inlinenodiscard

Reverses the order of iteration.

Returns
Lazy reverse view

Definition at line 386 of file query.hpp.

◆ Skip()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Skip ( size_t count) const -> utils::SkipAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator >
inlinenodiscard

Skips the first N elements.

Parameters
countNumber of elements to skip
Returns
Lazy skip view

Definition at line 1978 of file query.hpp.

◆ SkipWhile()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::SkipWhile ( Pred predicate) const -> utils::SkipWhileAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Pred >
inlinenodiscard

Skips elements while a predicate is true.

Template Parameters
PredPredicate function type
Parameters
predicateFunction to test each result
Returns
Lazy skip-while view

Definition at line 2014 of file query.hpp.

◆ Slide()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Slide ( size_t window_size) const -> utils::SlideAdapter< iterator >
inlinenodiscard

Creates sliding windows over query results.

Parameters
window_sizeSize of the sliding window
Returns
Lazy slide view
Warning
window_size must be greater than 0

Definition at line 396 of file query.hpp.

◆ StepBy()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::StepBy ( size_t step) const -> utils::StepByAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator >
inlinenodiscard

Yields every Nth element.

Parameters
stepInterval between yielded elements (must be > 0)
Returns
Lazy step-by view

Definition at line 2061 of file query.hpp.

◆ Stride()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Stride ( size_t stride) const -> utils::StrideAdapter< iterator >
inlinenodiscard

Takes every Nth element with stride.

Parameters
strideNumber of elements to skip between yields
Returns
Lazy stride view
Warning
stride must be greater than 0

Definition at line 407 of file query.hpp.

◆ Take()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Take ( size_t count) const -> utils::TakeAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator >
inlinenodiscard

Takes only the first N elements.

Parameters
countMaximum number of elements to take
Returns
Lazy take view

Definition at line 1965 of file query.hpp.

◆ TakeWhile()

template<typename WorldT, typename Allocator, QueryArg... Args>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
template<typename Pred>
requires utils::PredicateFor< Pred, typename BasicQueryWithEntity<WorldT, Allocator, Args...>::value_type>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::TakeWhile ( Pred predicate) const -> utils::TakeWhileAdapter< typename BasicQueryWithEntity< WorldT, Allocator, Args... >::iterator, Pred >
inlinenodiscard

Takes elements while a predicate is true.

Template Parameters
PredPredicate function type
Parameters
predicateFunction to test each result
Returns
Lazy take-while view

Definition at line 1995 of file query.hpp.

◆ TryGet()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::TryGet ( Entity entity) const -> std::optional< value_type >
inlinenodiscard

Tries to get all query components for a specific entity (ignores query filters).

Parameters
entityThe entity to get components for
Returns
Optional tuple of component access types for the entity

Definition at line 126 of file query.hpp.

◆ TryGetFiltered()

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::TryGetFiltered ( Entity entity) const -> std::optional< value_type >
inlinenodiscard

Tries to get all query components for a specific entity while respecting query filters.

Parameters
entityThe entity to get components for
Returns
Optional tuple of component access types for the entity

Definition at line 136 of file query.hpp.

◆ Zip() [1/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Zip ( const BasicQueryWithEntity< WorldT, Allocator, Args > & other) const -> utils::ZipAdapter< iterator, iterator >
inlinenodiscard

Zips this query with another query of the same type.

Parameters
otherQuery to zip with
Returns
Lazy zip view

Definition at line 431 of file query.hpp.

◆ Zip() [2/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
template<std::ranges::input_range R>
requires utils::ZipAdapterRequirements<iterator, std::ranges::iterator_t<const R>>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Zip ( const R & range) const -> utils::ZipAdapter< iterator, std::ranges::iterator_t< const R > >
inlinenodiscard

Zips this query with another const range.

Template Parameters
RRange type
Parameters
rangeRange to zip with
Returns
Lazy zip view

Definition at line 458 of file query.hpp.

◆ Zip() [3/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
template<typename OtherIter>
requires utils::ZipAdapterRequirements<iterator, OtherIter>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Zip ( OtherIter other_begin,
OtherIter other_end ) const -> utils::ZipAdapter< iterator, OtherIter >
inlinenodiscard

Zips this query with another iterator range.

Template Parameters
OtherIterIterator type to zip with
Parameters
other_beginBegin of other range
other_endEnd of other range
Returns
Lazy zip view

Definition at line 421 of file query.hpp.

◆ Zip() [4/4]

template<typename WorldT, typename Allocator, QueryArg... Args>
template<std::ranges::input_range R>
requires utils::ZipAdapterRequirements<iterator, std::ranges::iterator_t<R>>
auto helios::ecs::BasicQueryWithEntity< WorldT, Allocator, Args >::Zip ( R & range) const -> utils::ZipAdapter< iterator, std::ranges::iterator_t< R > >
inlinenodiscard

Zips this query with another range.

Template Parameters
RRange type
Parameters
rangeRange to zip with
Returns
Lazy zip view

Definition at line 444 of file query.hpp.