template<typename T, unsigned int M = DEFAULT_FILTER_MASK>
cubos::core::ecs::EventReader class

System arguments used to read events of type T.

Template parameters
T Event.
M Filter mask.

Filtering the received events by their mask is also possible via the parameter M. By default, the reader will read all events sent.

Public types

class Iterator
Used to iterate over events received by a reader.

Constructors, destructors, conversion operators

EventReader(const EventPipe<T>& pipe, std::size_t& index)
Constructs.

Public functions

auto read() -> const T*
Returns a reference to current event, and advances.
auto begin() -> Iterator
Returns an iterator to the first event.
auto end() -> Iterator
Returns an iterator to the end.

Function documentation

template<typename T, unsigned int M>
cubos::core::ecs::EventReader<T, M>::EventReader(const EventPipe<T>& pipe, std::size_t& index)

Constructs.

Parameters
pipe Event pipe to read events from.
index Reference to the reader's index.

Uses the given index to know which events it has already read. Increments it whenever it reads an event.

template<typename T, unsigned int M>
const T* cubos::core::ecs::EventReader<T, M>::read()

Returns a reference to current event, and advances.

Returns Pointer to current event, or null if there are no more events.

template<typename T, unsigned int M>
Iterator cubos::core::ecs::EventReader<T, M>::begin()

Returns an iterator to the first event.

Returns Iterator.

template<typename T, unsigned int M>
Iterator cubos::core::ecs::EventReader<T, M>::end()

Returns an iterator to the end.

Returns Iterator.