rotor
Event loop friendly C++ actor micro-framework
 
Loading...
Searching...
No Matches
starter.h
1#pragma once
2
3//
4// Copyright (c) 2019-2023 Ivan Baidakou (basiliscos) (the dot dmol at gmail dot com)
5//
6// Distributed under the MIT Software License
7//
8
9#include "plugin_base.h"
10
11namespace rotor::plugin {
12
19struct ROTOR_API starter_plugin_t : public plugin_base_t {
20 using plugin_base_t::plugin_base_t;
21
23 static const std::type_index class_identity;
24
25 const std::type_index &identity() const noexcept override;
26
27 void activate(actor_base_t *actor) noexcept override;
28 void deactivate() noexcept override;
29
31 template <typename Handler> subscription_info_ptr_t subscribe_actor(Handler &&handler) noexcept;
32
34 template <typename Handler>
35 subscription_info_ptr_t subscribe_actor(Handler &&handler, const address_ptr_t &addr) noexcept;
36
37 bool handle_init(message::init_request_t *) noexcept override;
38 void handle_start(message::start_trigger_t *message) noexcept override;
39 bool handle_subscription(message::subscription_t &message) noexcept override;
40
42 void on_start(message::start_trigger_t &message) noexcept;
43
44 private:
46 bool configured = false;
47};
48
49} // namespace rotor::plugin
intrusive_ptr_t< address_t > address_ptr_t
intrusive pointer for address
Definition address.hpp:57
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
allows custom (actor) subscriptions and it is responsible for starting actor when it receives message...
Definition starter.h:19
const std::type_index & identity() const noexcept override
returns pointer, which uniquely identifiess plugin type
static const std::type_index class_identity
Definition starter.h:23
list of subscription_info_ptr_t with possibility to find via subscription_point_t
Definition subscription_point.h:132
Holds and classifies message handlers on behalf of supervisor.
Definition subscription.h:30