OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::msgbus::message_storage Class Reference

Class storing message bus messages. More...

#include <eagine/message_bus/message.hpp>

Public Types

using fetch_handler = callable_ref< bool(message_id, message_age, const message_view &)>
 Alias for the message fetch handler. More...
 
using cleanup_predicate = callable_ref< bool(message_age)>
 Alias for message cleanup callable predicate. More...
 

Public Member Functions

 message_storage ()
 Default constructor.
 
auto empty () const noexcept -> bool
 Indicates if the storage is empty.
 
auto count () const noexcept -> span_size_t
 Returns the coung of messages in the storage.
 
void push (message_id msg_id, const message_view &message)
 Pushes a message into this storage.
 
template<typename Function >
auto push_if (Function function, span_size_t req_size=0) -> bool
 Pushes a new message and lets a function to fill it. More...
 
auto fetch_all (fetch_handler handler) -> bool
 Fetches all currently stored messages and calls handler on them.
 
void cleanup (cleanup_predicate predicate)
 Removes messages based on the result of the specified predicate.
 

Detailed Description

Class storing message bus messages.

See also
serialized_message_storage

Member Typedef Documentation

◆ cleanup_predicate

Alias for message cleanup callable predicate.

See also
cleanup

The return value indicates if a message should be removed.

◆ fetch_handler

Alias for the message fetch handler.

See also
fetch_all

The return value indicates if the message is considered handled and should be removed.

Member Function Documentation

◆ push_if()

template<typename Function >
auto eagine::msgbus::message_storage::push_if ( Function  function,
span_size_t  req_size = 0 
) -> bool
inline

Pushes a new message and lets a function to fill it.

The function's Boolean return value indicates if the message should be kept.


The documentation for this class was generated from the following file:

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).