9#include "../subscription.h"
10#include "rotor/messages.hpp"
14namespace rotor::plugin {
16enum class config_phase_t { PREINIT = 0b01, INITIALIZING = 0b10 };
29 SHUTDOWN = 0b00000010,
30 SUBSCRIPTION = 0b00000100,
48 virtual const std::type_index &
identity() const noexcept = 0;
73 virtual
void deactivate() noexcept;
83 virtual
bool handle_init(message::init_request_t *message) noexcept;
93 virtual
bool handle_shutdown(message::shutdown_request_t *message) noexcept;
103 virtual
void handle_start(message::start_trigger_t *message) noexcept;
146 template <typename Plugin, typename Fn>
147 void with_casted(Fn &&fn, config_phase_t desired_phase = config_phase_t::INITIALIZING) noexcept {
148 int phase_match =
static_cast<int>(phase) &
static_cast<int>(desired_phase);
149 if (phase_match && identity() == Plugin::class_identity) {
150 auto &
final =
static_cast<Plugin &
>(*this);
164 template <
typename T>
auto &
access() noexcept;
168 template <typename Handler>
187 reaction_underlying_t reaction = 0;
188 config_phase_t phase = config_phase_t::PREINIT;
intrusive_ptr_t< message_base_t > message_ptr_t
intrusive pointer for message
Definition message.h:118
intrusive_ptr_t< address_t > address_ptr_t
intrusive pointer for address
Definition address.hpp:57
intrusive_ptr_t< extended_error_t > extended_error_ptr_t
intrusive pointer to extended error type
Definition extended_error.h:25
intrusive_ptr_t< subscription_info_t > subscription_info_ptr_t
intrusive pointer for subscription_info_t
Definition subscription_point.h:127
universal primitive of concurrent computation
Definition actor_base.h:47
base class for all actor plugins
Definition plugin_base.h:23
std::underlying_type_t< reaction_t > reaction_underlying_t
the underlying type of reaction_t
Definition plugin_base.h:35
reaction_t
possible plugin's reactions on actor lifetime events
Definition plugin_base.h:27
reaction_underlying_t get_reaction() const noexcept
returns the current set of plugin reactions
Definition plugin_base.h:156
auto & access() noexcept
generic non-public fields accessor
plugin_base_t()=default
default plugin ctor
void reaction_on(reaction_t value) noexcept
turns on the specified reaction of the plugin
Definition plugin_base.h:159
virtual const std::type_index & identity() const noexcept=0
returns pointer, which uniquely identifiess plugin type
void reaction_off(reaction_t value) noexcept
turns off the specified reaction of the plugin
Definition plugin_base.h:162
plugin_base_t(const plugin_base_t &)=delete
copy ctor is not allowed
list of subscription_info_ptr_t with possibility to find via subscription_point_t
Definition subscription_point.h:132
pair of handler_base_t linked to particular address_t
Definition subscription_point.h:50
Holds and classifies message handlers on behalf of supervisor.
Definition subscription.h:30