Go to the documentation of this file.
9 #ifndef EAGINE_MESSAGE_BUS_CONNECTION_HPP
10 #define EAGINE_MESSAGE_BUS_CONNECTION_HPP
12 #include "../callable_ref.hpp"
13 #include "../interface.hpp"
14 #include "../message_id.hpp"
15 #include "../type_identity.hpp"
16 #include "../valid_if/positive.hpp"
19 #include <type_traits>
39 template <
typename Selector>
42 return enumerator_map_type<connection_addr_kind, 3>{
50 template <connection_addr_kind Kind>
52 std::integral_constant<connection_addr_kind, Kind>;
66 template <
typename Selector>
69 return enumerator_map_type<connection_protocol, 3>{
79 template <connection_protocol Proto>
81 std::integral_constant<connection_protocol, Proto>;
159 virtual auto add_connection(std::unique_ptr<connection>) ->
bool = 0;
164 #endif // EAGINE_MESSAGE_BUS_CONNECTION_HPP
virtual auto update() -> bool
Updates the internal state of the connection (called repeatedly).
Definition: connection.hpp:123
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
Declaration of class template storing a reference to a callable object.
Definition: callable_ref.hpp:24
std::integral_constant< connection_protocol, Proto > connection_protocol_tag
Tag template alias for specifying connection protocol kind.
Definition: connection.hpp:81
virtual void cleanup()
Cleans up the connection before destroying it.
Definition: connection.hpp:128
Primary template for conditionally valid values.
Definition: decl.hpp:49
virtual auto send(message_id msg_id, const message_view &) -> bool=0
Sent a message with the specified id.
Interface for message bus connections.
Definition: connection.hpp:114
Base template for abstract interfaces, implements common functionality.
Definition: interface.hpp:18
connection_protocol_tag< connection_protocol::stream > stream_protocol_tag
Tag type for specifying stream connection protocols.
Definition: connection.hpp:87
Interface for classes that can use message bus connections.
Definition: connection.hpp:155
Combines message information and a non-owning view to message content.
Definition: message.hpp:288
virtual auto type_id() -> identifier=0
Returns a description identifier of the implementation.
virtual auto max_data_size() -> valid_if_positive< span_size_t >
Returns the maximum data block size in bytes that can be sent.
Definition: connection.hpp:136
connection_protocol_tag< connection_protocol::datagram > datagram_protocol_tag
Tag type for specifying datagram connection protocols.
Definition: connection.hpp:93
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
virtual auto kind() -> connection_kind=0
Returns the connection kind.
@ message
Message protocol.
constexpr const span_size_t min_connection_data_size
The minimum guaranteed block size that can be sent through bus connections.
Definition: connection.hpp:25
connection_addr_kind
Message bus connection address kind enumeration.
Definition: connection.hpp:30
virtual auto addr_kind() -> connection_addr_kind=0
Returns the connection address kind.
callable_ref< bool(message_id, message_age, const message_view &)> fetch_handler
Alias for fetch handler callable reference type.
Definition: connection.hpp:118
connection_kind
Message bus connection kind bits enumeration.
Definition: connection_kind.hpp:21
Basic interface for retrieving message bus connection information.
Definition: connection.hpp:98
virtual auto fetch_messages(fetch_handler handler) -> bool=0
Fetch all enqueued messages that have been received since last fetch.
@ stream
Reliable stream protocol.
Template type used mostly for function type-tag dispatching.
Definition: type_identity.hpp:19
Class storing two identifier values representing class/method pair.
Definition: message_id.hpp:25
@ datagram
Datagram protocol.
virtual auto add_connection(std::unique_ptr< connection >) -> bool=0
Adds the specified message bus connection. Result indicates if the connection was used or discarded.
connection_protocol
Message bus connection protocol.
Definition: connection.hpp:57
virtual auto is_usable() -> bool
Checks if the connection is in usable state.
Definition: connection.hpp:131
@ filepath
Filesystem path.
std::integral_constant< connection_addr_kind, Kind > connection_addr_kind_tag
Tag template alias for specifying connection address kind.
Definition: connection.hpp:52
std::chrono::duration< float > message_age
Alias for message age type.
Definition: message.hpp:54