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

Bidirectional iterator that yields ConsumableMessageWrapper<T> instances with consume support. More...

#include <reader.hpp>

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

Public Types

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

Public Member Functions

constexpr ConsumableMessageWrapperIter () noexcept=default
constexpr ConsumableMessageWrapperIter (std::span< const T > first, std::span< const T > second, std::reference_wrapper< ConsumedMessagesRegistry<> > registry, size_t position) noexcept
 Constructs a wrapper iterator over two contiguous message spans.
constexpr ConsumableMessageWrapperIter (const ConsumableMessageWrapperIter &) noexcept=default
constexpr ConsumableMessageWrapperIter (ConsumableMessageWrapperIter &&) noexcept=default
constexpr ~ConsumableMessageWrapperIter () noexcept=default
constexpr ConsumableMessageWrapperIteroperator= (const ConsumableMessageWrapperIter &) noexcept=default
constexpr ConsumableMessageWrapperIteroperator= (ConsumableMessageWrapperIter &&) noexcept=default
constexpr reference operator* () const noexcept
pointer operator-> () const =delete
constexpr ConsumableMessageWrapperIteroperator++ () noexcept
constexpr ConsumableMessageWrapperIter operator++ (int) noexcept
constexpr ConsumableMessageWrapperIteroperator-- () noexcept
constexpr ConsumableMessageWrapperIter operator-- (int) noexcept
constexpr auto operator<=> (const ConsumableMessageWrapperIter &other) const noexcept
constexpr bool operator== (const ConsumableMessageWrapperIter &other) const noexcept
constexpr bool operator!= (const ConsumableMessageWrapperIter &other) const noexcept
constexpr size_t Position () const noexcept
 Returns the current logical position in the combined sequence.
constexpr ConsumableMessageWrapperIter begin () const noexcept
 Returns a copy of this iterator positioned at the beginning of the sequence.
constexpr ConsumableMessageWrapperIter end () const noexcept
 Returns a copy of this iterator positioned one past the last element.
Public Member Functions inherited from helios::utils::FunctionalAdapterBase< ConsumableMessageWrapperIter< T > >
constexpr auto Filter (Pred predicate) const noexcept(noexcept(FilterAdapter< ConsumableMessageWrapperIter< 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< ConsumableMessageWrapperIter< 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< ConsumableMessageWrapperIter< 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< ConsumableMessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), count)))
 Skips the first count elements.
constexpr auto TakeWhile (Pred predicate) const noexcept(noexcept(TakeWhileAdapter< ConsumableMessageWrapperIter< 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< ConsumableMessageWrapperIter< T >, Pred >(GetDerived().begin(), GetDerived().end(), std::move(predicate))))
 Skips elements while a predicate is true.
constexpr auto Enumerate () const noexcept(noexcept(EnumerateAdapter< ConsumableMessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end())))
 Adds an index to each element.
constexpr auto Inspect (Func inspector) const noexcept(noexcept(InspectAdapter< ConsumableMessageWrapperIter< 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< ConsumableMessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), step)))
 Takes every Nth element.
constexpr auto Chain (OtherIter begin, OtherIter end) const noexcept(noexcept(ChainAdapter< ConsumableMessageWrapperIter< 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< ConsumableMessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end())))
 Reverses the order of elements.
constexpr auto Slide (size_t window_size) const noexcept(noexcept(SlideAdapter< ConsumableMessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), window_size)))
 Creates sliding windows over elements.
constexpr auto Stride (size_t stride) const noexcept(noexcept(StrideAdapter< ConsumableMessageWrapperIter< T > >(GetDerived().begin(), GetDerived().end(), stride)))
 Takes every Nth element with stride.
constexpr auto Zip (OtherIter begin, OtherIter end) const noexcept(noexcept(ZipAdapter< ConsumableMessageWrapperIter< 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< ConsumableMessageWrapperIter< T > >
constexpr ConsumableMessageWrapperIter< T > & GetDerived () noexcept
 Gets reference to derived class instance.

Detailed Description

template<ConsumableMessageTrait T>
class helios::ecs::ConsumableMessageWrapperIter< T >

Bidirectional iterator that yields ConsumableMessageWrapper<T> instances with consume support.

Each wrapper carries a const reference to the message, a reference to ConsumedMessagesRegistry, and the global index, enabling the caller to mark individual messages as consumed 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 ConsumableMessageWrapper<T> values.
Template Parameters
TMessage type satisfying ConsumableMessageTrait

Definition at line 163 of file reader.hpp.

Member Typedef Documentation

◆ difference_type

template<ConsumableMessageTrait T>
using helios::ecs::ConsumableMessageWrapperIter< T >::difference_type = ptrdiff_t

Definition at line 171 of file reader.hpp.

◆ iterator_category

template<ConsumableMessageTrait T>
using helios::ecs::ConsumableMessageWrapperIter< T >::iterator_category = std::input_iterator_tag

Definition at line 167 of file reader.hpp.

◆ iterator_concept

template<ConsumableMessageTrait T>
using helios::ecs::ConsumableMessageWrapperIter< T >::iterator_concept = std::bidirectional_iterator_tag

Definition at line 166 of file reader.hpp.

◆ pointer

template<ConsumableMessageTrait T>
using helios::ecs::ConsumableMessageWrapperIter< T >::pointer = void

Definition at line 170 of file reader.hpp.

◆ reference

template<ConsumableMessageTrait T>
using helios::ecs::ConsumableMessageWrapperIter< T >::reference = value_type

Definition at line 169 of file reader.hpp.

◆ value_type

template<ConsumableMessageTrait T>
using helios::ecs::ConsumableMessageWrapperIter< T >::value_type = ConsumableMessageWrapper<T>

Definition at line 168 of file reader.hpp.

Constructor & Destructor Documentation

◆ ConsumableMessageWrapperIter() [1/4]

template<ConsumableMessageTrait T>
helios::ecs::ConsumableMessageWrapperIter< T >::ConsumableMessageWrapperIter ( )
constexprdefaultnoexcept

◆ ConsumableMessageWrapperIter() [2/4]

template<ConsumableMessageTrait T>
helios::ecs::ConsumableMessageWrapperIter< T >::ConsumableMessageWrapperIter ( std::span< const T > first,
std::span< const T > second,
std::reference_wrapper< ConsumedMessagesRegistry<> > registry,
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
registryPer-system consumed messages registry
positionLogical position in the combined [first | second] sequence

Definition at line 182 of file reader.hpp.

◆ ConsumableMessageWrapperIter() [3/4]

template<ConsumableMessageTrait T>
helios::ecs::ConsumableMessageWrapperIter< T >::ConsumableMessageWrapperIter ( const ConsumableMessageWrapperIter< T > & )
constexprdefaultnoexcept

◆ ConsumableMessageWrapperIter() [4/4]

template<ConsumableMessageTrait T>
helios::ecs::ConsumableMessageWrapperIter< T >::ConsumableMessageWrapperIter ( ConsumableMessageWrapperIter< T > && )
constexprdefaultnoexcept

◆ ~ConsumableMessageWrapperIter()

template<ConsumableMessageTrait T>
helios::ecs::ConsumableMessageWrapperIter< T >::~ConsumableMessageWrapperIter ( )
constexprdefaultnoexcept

Member Function Documentation

◆ begin()

template<ConsumableMessageTrait T>
ConsumableMessageWrapperIter helios::ecs::ConsumableMessageWrapperIter< T >::begin ( ) const
inlinenodiscardconstexprnoexcept

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

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

Returns
Iterator reset to position 0

Definition at line 263 of file reader.hpp.

◆ end()

template<ConsumableMessageTrait T>
ConsumableMessageWrapperIter helios::ecs::ConsumableMessageWrapperIter< 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 272 of file reader.hpp.

◆ operator!=()

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

Definition at line 245 of file reader.hpp.

◆ operator*()

template<ConsumableMessageTrait T>
reference helios::ecs::ConsumableMessageWrapperIter< T >::operator* ( ) const
inlinenodiscardconstexprnoexcept

Definition at line 202 of file reader.hpp.

◆ operator++() [1/2]

template<ConsumableMessageTrait T>
ConsumableMessageWrapperIter & helios::ecs::ConsumableMessageWrapperIter< T >::operator++ ( )
inlineconstexprnoexcept

Definition at line 211 of file reader.hpp.

◆ operator++() [2/2]

template<ConsumableMessageTrait T>
ConsumableMessageWrapperIter helios::ecs::ConsumableMessageWrapperIter< T >::operator++ ( int )
inlinenodiscardconstexprnoexcept

Definition at line 216 of file reader.hpp.

◆ operator--() [1/2]

template<ConsumableMessageTrait T>
ConsumableMessageWrapperIter & helios::ecs::ConsumableMessageWrapperIter< T >::operator-- ( )
inlineconstexprnoexcept

Definition at line 223 of file reader.hpp.

◆ operator--() [2/2]

template<ConsumableMessageTrait T>
ConsumableMessageWrapperIter helios::ecs::ConsumableMessageWrapperIter< T >::operator-- ( int )
inlinenodiscardconstexprnoexcept

Definition at line 228 of file reader.hpp.

◆ operator->()

template<ConsumableMessageTrait T>
pointer helios::ecs::ConsumableMessageWrapperIter< T >::operator-> ( ) const
delete

◆ operator<=>()

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

Definition at line 235 of file reader.hpp.

◆ operator=() [1/2]

template<ConsumableMessageTrait T>
ConsumableMessageWrapperIter & helios::ecs::ConsumableMessageWrapperIter< T >::operator= ( const ConsumableMessageWrapperIter< T > & )
constexprdefaultnoexcept

◆ operator=() [2/2]

template<ConsumableMessageTrait T>
ConsumableMessageWrapperIter & helios::ecs::ConsumableMessageWrapperIter< T >::operator= ( ConsumableMessageWrapperIter< T > && )
constexprdefaultnoexcept

◆ operator==()

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

Definition at line 240 of file reader.hpp.

◆ Position()

template<ConsumableMessageTrait T>
size_t helios::ecs::ConsumableMessageWrapperIter< T >::Position ( ) const
inlinenodiscardconstexprnoexcept

Returns the current logical position in the combined sequence.

Returns
Zero-based position index

Definition at line 254 of file reader.hpp.