template<typename T>
cubos::core::ecs::EventPipe class

Resource which stores events of type T.

Template parameters
T Event type.

Public functions

void push(T event, unsigned int mask = DEFAULT_PUSH_MASK)
Pushes an event into the event pipe.
auto getEventMask(std::size_t index) const -> unsigned int
Returns the event mask from event pipe at the given index.
auto get(std::size_t index) const -> std::pair<const T&, unsigned int>
Returns the event and mask with the given index.
void clear()
Clears events that have been read by all readers.
auto sentEvents() const -> std::size_t
Returns the number of events that already were sent.
auto size() const -> std::size_t
Returns the number of events that are present on the pipe.
void addReader()
Adds a new reader to reader count.
void removeReader()
Removes a reader from reader count.

Function documentation

template<typename T>
void cubos::core::ecs::EventPipe<T>::push(T event, unsigned int mask = DEFAULT_PUSH_MASK)

Pushes an event into the event pipe.

Parameters
event Event.
mask Mask.

template<typename T>
unsigned int cubos::core::ecs::EventPipe<T>::getEventMask(std::size_t index) const

Returns the event mask from event pipe at the given index.

Parameters
index Event index.
Returns Event mask.

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

Returns the event and mask with the given index.

Parameters
index Event index.
Returns Event and mask.

template<typename T>
std::size_t cubos::core::ecs::EventPipe<T>::sentEvents() const

Returns the number of events that already were sent.

Returns Number of events that already were sent.

template<typename T>
std::size_t cubos::core::ecs::EventPipe<T>::size() const

Returns the number of events that are present on the pipe.

Returns Number of events that are present on the pipe.

template<typename T>
void cubos::core::ecs::EventPipe<T>::addReader()

Adds a new reader to reader count.

This is necessary to keep track of when its okay to delete events on clear().

template<typename T>
void cubos::core::ecs::EventPipe<T>::removeReader()

Removes a reader from reader count.