Go to the documentation of this file.
9 #ifndef EAGINE_MESSAGE_BUS_REGISTRY_HPP
10 #define EAGINE_MESSAGE_BUS_REGISTRY_HPP
12 #include "../main_ctx_object.hpp"
21 struct registered_entry {
22 std::unique_ptr<endpoint> _endpoint{};
23 std::unique_ptr<service_interface> _service{};
25 auto update_service() -> bool;
38 return *(_add_entry(log_id)._endpoint);
43 template <
typename Service>
45 enable_if_t<std::is_base_of_v<service_interface, Service>, Service&> {
46 auto& entry = _add_entry(log_id);
47 auto temp{std::make_unique<Service>(*(entry._endpoint))};
49 entry._service = std::move(temp);
53 auto update() -> bool;
54 auto update_all() -> bool;
60 std::shared_ptr<direct_acceptor> _acceptor;
62 std::vector<registered_entry> _entries;
64 auto _add_entry(
identifier log_id) -> registered_entry&;
69 #if !EAGINE_LINK_LIBRARY || defined(EAGINE_IMPLEMENTING_LIBRARY)
70 #include <eagine/message_bus/registry.inl>
73 #endif // EAGINE_MESSAGE_BUS_REGISTRY_HPP
auto establish(identifier log_id) -> endpoint &
Establishes a new endpoint with the specified logger identifier.
Definition: registry.hpp:37
Helper class used to initialize main context objects.
Definition: main_ctx_object.hpp:45
Base class for main context objects.
Definition: main_ctx_object.hpp:71
registry(main_ctx_parent parent)
Construction from parent main context object.
auto emplace(identifier log_id) -> std::enable_if_t< std::is_base_of_v< service_interface, Service >, Service & >
Establishes an endpoint and instantiates a service object tied to it.
Definition: registry.hpp:44
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
Class combining a local bus router and a set of endpoints.
Definition: registry.hpp:30
Message bus client endpoint that can send and receive messages.
Definition: endpoint.hpp:30