36 using plugin_base_t::plugin_base_t;
39 enum class phase_t { discovering, linking };
49 enum class state_t { PASSIVE, DISCOVERING, LINKING, OPERATIONAL, CANCELLING };
53 link_on_discovery =
true;
54 operational_only = operational_only_;
59 template <
typename Callback>
void callback(Callback &&cb)
noexcept {
60 task_callback = std::forward<Callback>(cb);
64 template <
typename T,
typename... Args>
auto access(Args... args)
noexcept;
68 : plugin{&plugin_}, address(address_), service_name{service_name_}, delayed{delayed_},
70 operator bool() const noexcept {
return address; }
72 void do_discover() noexcept;
74 bool do_cancel() noexcept;
80 std::
string service_name;
84 callback_t task_callback;
85 bool link_on_discovery = false;
86 bool operational_only = false;
92 static const std::type_index class_identity;
94 const std::type_index &identity() const noexcept override;
99 virtual
void on_registration(message::registration_response_t &) noexcept;
102 virtual
void on_discovery(message::discovery_response_t &) noexcept;
105 virtual
void on_future(message::discovery_future_t &message) noexcept;
112 virtual
void register_name(const std::
string &name, const
address_ptr_t &address) noexcept;
125 bool delayed = false) noexcept;
127 bool handle_shutdown(message::shutdown_request_t *message) noexcept override;
128 bool handle_init(message::init_request_t *message) noexcept override;
131 template <typename T> auto &access() noexcept;
137 enum class state_t { REGISTERING, LINKING, OPERATIONAL, UNREGISTERING };
138 struct register_info_t {
142 using register_map_t = std::unordered_map<std::string, register_info_t>;
143 using names_t = std::vector<std::string>;
144 using aliases_map_t = std::unordered_map<address_ptr_t, names_t>;
146 enum plugin_state_t : std::uint32_t {
151 std::uint32_t plugin_state = 0;
153 register_map_t register_map;
154 discovery_map_t discovery_map;
155 aliases_map_t aliases_map;
157 void link_registry() noexcept;
158 void on_link(const extended_error_ptr_t &ec) noexcept;
159 bool has_registering() noexcept;
160 virtual
void continue_init(const error_code_t &possible_ec, const extended_error_ptr_t &root_ec) noexcept;
intrusive_ptr_t< extended_error_t > extended_error_ptr_t
intrusive pointer to extended error type
Definition extended_error.h:25