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

Bidirectional iterator that yields MessageWrapper<T> instances. More...

#include <reader.hpp>

Inheritance diagram for helios::ecs::MessageWrapperIter< T >:
helios::utils::FunctionalAdapterBase< MessageWrapperIter< T > >

Public Types

using iterator_concept = std::bidirectional_iterator_tag
using iterator_category = std::input_iterator_tag
using value_type = MessageWrapper<T>
using reference = value_type
using pointer = void
using difference_type = ptrdiff_t

Public Member Functions

constexpr MessageWrapperIter () noexcept=default
constexpr MessageWrapperIter (std::span< const T > first, std::span< const T > second, size_t position) noexcept
 Constructs a wrapper iterator over two contiguous message spans.
constexpr MessageWrapperIter (const MessageWrapperIter &) noexcept=default
constexpr MessageWrapperIter (MessageWrapperIter &&) noexcept=default
constexpr ~MessageWrapperIter () noexcept=default
constexpr MessageWrapperIteroperator= (const MessageWrapperIter &) noexcept=default
constexpr MessageWrapperIteroperator= (MessageWrapperIter &&) noexcept=default
constexpr reference operator* () const noexcept
pointer operator-> () const =delete
constexpr MessageWrapperIteroperator++ () noexcept
constexpr MessageWrapperIter operator++ (int) noexcept
constexpr MessageWrapperIteroperator-- () noexcept
constexpr MessageWrapperIter operator-- (int) noexcept
constexpr auto operator<=> (const MessageWrapperIter &other) const noexcept
constexpr bool operator== (const MessageWrapperIter &other) const noexcept
constexpr bool operator!= (const MessageWrapperIter &other) const noexcept
constexpr size_t Position () const noexcept
 Returns the current logical position in the combined sequence.
constexpr MessageWrapperIter begin () const noexcept
 Returns a copy of this iterator positioned at the beginning of the sequence.
constexpr MessageWrapperIter end () const noexcept
 Returns a copy of this iterator positioned one past the last element.
Public Member Functions inherited from helios::utils::FunctionalAdapterBase< MessageWrapperIter< T > >
constexpr auto Filter (Pred predicate) const noexcept(noexcept(FilterAdapter< MessageWrapperIter< T >, Pred >(GetDerived().begin(), GetDerived().end(), std::move(predicate))))
 Chains another filter operation on top of this iterator.
constexpr auto Map (Func transform) const noexcept(noexcept(MapAdapter< MessageWrapperIter< T >, Func >(GetDerived().begin(), GetDerived().end(), std::move(transform))))
 Transforms each element using the given function.
constexpr auto Take (size_t count) const noexcept(noexcept(TakeAdapter< MessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), count)))
 Limits the number of elements to at most count.
constexpr auto Skip (size_t count) const noexcept(noexcept(SkipAdapter< MessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), count)))
 Skips the first count elements.
constexpr auto TakeWhile (Pred predicate) const noexcept(noexcept(TakeWhileAdapter< MessageWrapperIter< T >, Pred >(GetDerived().begin(), GetDerived().end(), std::move(predicate))))
 Takes elements while a predicate is true.
constexpr auto SkipWhile (Pred predicate) const noexcept(noexcept(SkipWhileAdapter< MessageWrapperIter< T >, Pred >(GetDerived().begin(), GetDerived().end(), std::move(predicate))))
 Skips elements while a predicate is true.
constexpr auto Enumerate () const noexcept(noexcept(EnumerateAdapter< MessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end())))
 Adds an index to each element.
constexpr auto Inspect (Func inspector) const noexcept(noexcept(InspectAdapter< MessageWrapperIter< T >, Func >(GetDerived().begin(), GetDerived().end(), std::move(inspector))))
 Observes each element without modifying it.
constexpr auto StepBy (size_t step) const noexcept(noexcept(StepByAdapter< MessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), step)))
 Takes every Nth element.
constexpr auto Chain (OtherIter begin, OtherIter end) const noexcept(noexcept(ChainAdapter< MessageWrapperIter< T >, OtherIter >(GetDerived().begin(), GetDerived().end(), std::move(begin), std::move(end))))
 Chains another range after this one.
constexpr auto Reverse () const noexcept(noexcept(ReverseAdapter< MessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end())))
 Reverses the order of elements.
constexpr auto Slide (size_t window_size) const noexcept(noexcept(SlideAdapter< MessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), window_size)))
 Creates sliding windows over elements.
constexpr auto Stride (size_t stride) const noexcept(noexcept(StrideAdapter< MessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), stride)))
 Takes every Nth element with stride.
constexpr auto Zip (OtherIter begin, OtherIter end) const noexcept(noexcept(ZipAdapter< MessageWrapperIter< T >, OtherIter >(GetDerived().begin(), GetDerived().end(), std::move(begin), std::move(end))))
 Zips another range with this one.
constexpr void ForEach (const Action &action) const
 Terminal operation: applies an action to each element.
constexpr T Fold (T init, const Folder &folder) const
 Terminal operation: reduces elements to a single value using a folder function.
constexpr auto Find (const Pred &predicate) const
 Terminal operation: finds the first element satisfying a predicate.
constexpr size_t CountIf (const Pred &predicate) const
 Terminal operation: counts elements satisfying a predicate.
constexpr auto Partition (const Pred &predicate) const
 Terminal operation: partitions elements into two groups based on a predicate.
constexpr auto PartitionWith (const Pred &predicate, Allocator allocator) const
 Terminal operation: partitions elements with a custom allocator.
constexpr auto MaxBy (const KeyFunc &key_func) const
 Terminal operation: finds the element with the maximum value according to a key function.
constexpr auto MinBy (const KeyFunc &key_func) const
 Terminal operation: finds the element with the minimum value according to a key function.
constexpr auto GroupBy (const KeyFunc &key_func) const
 Terminal operation: groups elements by a key function.
constexpr auto GroupByWith (const KeyFunc &key_func, MapAllocator map_allocator, ValueAllocator value_allocator) const
 Terminal operation: groups elements by key with custom allocators.
constexpr auto Collect () const
 Terminal operation: collects all elements into a vector.
constexpr auto CollectWith (Allocator allocator={}) const
 Terminal operation: collects all elements into a vector with a custom allocator.
constexpr void Into (OutIt out) const
 Terminal operation: writes all elements into an output iterator.
constexpr bool Any (const Pred &predicate) const
 Terminal operation: checks if any element satisfies a predicate.
constexpr bool All (const Pred &predicate) const
 Terminal operation: checks if all elements satisfy a predicate.
constexpr bool None (const Pred &predicate) const
 Terminal operation: checks if no elements satisfy a predicate.

Additional Inherited Members

Protected Member Functions inherited from helios::utils::FunctionalAdapterBase< MessageWrapperIter< T > >
constexpr MessageWrapperIter< T > & GetDerived () noexcept
 Gets reference to derived class instance.

Detailed Description

template<MessageTrait T>
class helios::ecs::MessageWrapperIter< T >

Bidirectional iterator that yields MessageWrapper<T> instances.

Each wrapper carries a const reference to the message and the global index, enabling the caller to access the message during iteration.

Derives from FunctionalAdapterBase so the iterator itself can be used as a lazy range, enabling chained adapter calls such as .Filter(...), .Map(...), .Take(...), etc.

Note
The adapter methods operate on MessageWrapper<T> values.
Template Parameters
TMessage type satisfying MessageTrait

Definition at line 38 of file reader.hpp.

Member Typedef Documentation

◆ difference_type

template<MessageTrait T>
using helios::ecs::MessageWrapperIter< T >::difference_type = ptrdiff_t

Definition at line 46 of file reader.hpp.

◆ iterator_category

template<MessageTrait T>
using helios::ecs::MessageWrapperIter< T >::iterator_category = std::input_iterator_tag

Definition at line 42 of file reader.hpp.

◆ iterator_concept

template<MessageTrait T>
using helios::ecs::MessageWrapperIter< T >::iterator_concept = std::bidirectional_iterator_tag

Definition at line 41 of file reader.hpp.

◆ pointer

template<MessageTrait T>
using helios::ecs::MessageWrapperIter< T >::pointer = void

Definition at line 45 of file reader.hpp.

◆ reference

template<MessageTrait T>
using helios::ecs::MessageWrapperIter< T >::reference = value_type

Definition at line 44 of file reader.hpp.

◆ value_type

template<MessageTrait T>
using helios::ecs::MessageWrapperIter< T >::value_type = MessageWrapper<T>

Definition at line 43 of file reader.hpp.

Constructor & Destructor Documentation

◆ MessageWrapperIter() [1/4]

template<MessageTrait T>
helios::ecs::MessageWrapperIter< T >::MessageWrapperIter ( )
constexprdefaultnoexcept

◆ MessageWrapperIter() [2/4]

template<MessageTrait T>
helios::ecs::MessageWrapperIter< T >::MessageWrapperIter ( std::span< const T > first,
std::span< const T > second,
size_t position )
inlineconstexprnoexcept

Constructs a wrapper iterator over two contiguous message spans.

Parameters
firstSpan of messages from the previous frame
secondSpan of messages from the current frame
positionLogical position in the combined [first | second] sequence

Definition at line 56 of file reader.hpp.

◆ MessageWrapperIter() [3/4]

template<MessageTrait T>
helios::ecs::MessageWrapperIter< T >::MessageWrapperIter ( const MessageWrapperIter< T > & )
constexprdefaultnoexcept

◆ MessageWrapperIter() [4/4]

template<MessageTrait T>
helios::ecs::MessageWrapperIter< T >::MessageWrapperIter ( MessageWrapperIter< T > && )
constexprdefaultnoexcept

◆ ~MessageWrapperIter()

template<MessageTrait T>
helios::ecs::MessageWrapperIter< T >::~MessageWrapperIter ( )
constexprdefaultnoexcept

Member Function Documentation

◆ begin()

template<MessageTrait T>
MessageWrapperIter helios::ecs::MessageWrapperIter< T >::begin ( ) const
inlinenodiscardconstexprnoexcept

Returns a copy of this iterator positioned at the beginning of the sequence.

Required so MessageWrapperIter can act as a self-contained range for FunctionalAdapterBase adapter methods.

Returns
Iterator reset to position 0

Definition at line 129 of file reader.hpp.

◆ end()

template<MessageTrait T>
MessageWrapperIter helios::ecs::MessageWrapperIter< T >::end ( ) const
inlinenodiscardconstexprnoexcept

Returns a copy of this iterator positioned one past the last element.

Returns
Iterator at position first_.size() + second_.size()

Definition at line 138 of file reader.hpp.

◆ operator!=()

template<MessageTrait T>
bool helios::ecs::MessageWrapperIter< T >::operator!= ( const MessageWrapperIter< T > & other) const
inlinenodiscardconstexprnoexcept

Definition at line 111 of file reader.hpp.

◆ operator*()

template<MessageTrait T>
reference helios::ecs::MessageWrapperIter< T >::operator* ( ) const
inlinenodiscardconstexprnoexcept

Definition at line 70 of file reader.hpp.

◆ operator++() [1/2]

template<MessageTrait T>
MessageWrapperIter & helios::ecs::MessageWrapperIter< T >::operator++ ( )
inlineconstexprnoexcept

Definition at line 79 of file reader.hpp.

◆ operator++() [2/2]

template<MessageTrait T>
MessageWrapperIter helios::ecs::MessageWrapperIter< T >::operator++ ( int )
inlinenodiscardconstexprnoexcept

Definition at line 84 of file reader.hpp.

◆ operator--() [1/2]

template<MessageTrait T>
MessageWrapperIter & helios::ecs::MessageWrapperIter< T >::operator-- ( )
inlineconstexprnoexcept

Definition at line 90 of file reader.hpp.

◆ operator--() [2/2]

template<MessageTrait T>
MessageWrapperIter helios::ecs::MessageWrapperIter< T >::operator-- ( int )
inlinenodiscardconstexprnoexcept

Definition at line 95 of file reader.hpp.

◆ operator->()

template<MessageTrait T>
pointer helios::ecs::MessageWrapperIter< T >::operator-> ( ) const
delete

◆ operator<=>()

template<MessageTrait T>
auto helios::ecs::MessageWrapperIter< T >::operator<=> ( const MessageWrapperIter< T > & other) const
inlinenodiscardconstexprnoexcept

Definition at line 101 of file reader.hpp.

◆ operator=() [1/2]

template<MessageTrait T>
MessageWrapperIter & helios::ecs::MessageWrapperIter< T >::operator= ( const MessageWrapperIter< T > & )
constexprdefaultnoexcept

◆ operator=() [2/2]

template<MessageTrait T>
MessageWrapperIter & helios::ecs::MessageWrapperIter< T >::operator= ( MessageWrapperIter< T > && )
constexprdefaultnoexcept

◆ operator==()

template<MessageTrait T>
bool helios::ecs::MessageWrapperIter< T >::operator== ( const MessageWrapperIter< T > & other) const
inlinenodiscardconstexprnoexcept

Definition at line 106 of file reader.hpp.

◆ Position()

template<MessageTrait T>
size_t helios::ecs::MessageWrapperIter< T >::Position ( ) const
inlinenodiscardconstexprnoexcept

Returns the current logical position in the combined sequence.

Returns
Zero-based position index

Definition at line 120 of file reader.hpp.