10#include "rotor-light-bsp.h"
15namespace rotor_light {
55 void start(
bool poll_timer =
false);
133 void on_child_init_failure(
size_t actor_index);
135 void on_child_down(
size_t actor_index);
136 void init_child(
size_t actor_index);
137 void start_actor(
size_t actor_index);
138 size_t process_watchdog();
139 bool check_child_state(State subject,
bool skip_self);
145template <
size_t HandlersCount,
typename... Actors>
148 "no enough handlers");
159 return &std::get<ChildIndex>(
children);
183 template <
size_t ChildIndex>
void fill_actor() {
185 actors[ChildIndex + 1] = get_child<ChildIndex>();
186 fill_actor<ChildIndex + 1>();
192template <
typename Ctx,
typename MessageType,
typename... Args>
195 if constexpr (std::is_same_v<Ctx, ctx::thread>) {
196 ROTOR_LIGHT_DISABLE_INTERRUPTS();
199 queue->put<MessageType>(queue_index, std::forward<Args>(args)...);
200 if constexpr (std::is_same_v<Ctx, ctx::thread>) {
201 ROTOR_LIGHT_ENABLE_INTERRUPTS();
206template <
typename Ctx>
runtime info about message subscription handler
Definition: actor.hpp:42
base interface and implementation for all actors, including supervisors
Definition: actor.hpp:19
bool send(size_t queue_index, Args... args)
emplaces new message into appropriate queue
Definition: supervisor.hpp:193
EventId add_event(Duration delta, Callback callback, void *data)
Definition: supervisor.hpp:207
static constexpr size_t min_handlers_amount
Definition: actor.hpp:55
SupervisorBase * supervisor
Definition: actor.hpp:180
root supervisor initialization tuple
Definition: context.hpp:18
base class for all rotor-light messages
Definition: message.hpp:22
bookeeper of future events
Definition: planner.hpp:59
EventId add_event(TimePoint when, Callback callback, void *data)
records the new event
Definition: planner.hpp:73
base class for meta-queue (list of queues, ordered by priorities))
Definition: queue.hpp:124
base interface and implementation for all supervisors
Definition: supervisor.hpp:29
uint8_t bind(ActorId initial_value, SupervisorBase *supervisor, Context &context) override
size_t actors_count
Definition: supervisor.hpp:120
PlannerBase * get_planner()
Definition: supervisor.hpp:101
ActorBase ** actors
Definition: supervisor.hpp:114
virtual void bind(Context &context, ActorId value=0)
NowFunction now
Definition: supervisor.hpp:129
void start(bool poll_timer=false)
starts all actors (initialize, wait confirmation etc.)
static constexpr size_t min_handlers_amount
Definition: supervisor.hpp:34
QueueBase * queue
Definition: supervisor.hpp:123
virtual void on_refhesh_timer(message::RefreshTime &)
void advance_stop() override
void advance_init() override
void advance_start() override
void initialize() override
SupervisorBase(char *backends, size_t backends_count, ActorBase **actors, details::ChildState *states, size_t actors_count)
PlannerBase * planner
Definition: supervisor.hpp:126
details::ChildState * states
Definition: supervisor.hpp:117
QueueBase * get_queue()
Definition: supervisor.hpp:45
convenient templated base class for supervisor, which owns (stores) all it's child-actors
Definition: supervisor.hpp:146
ActorBase::Handler backends[HandlersCount]
Definition: supervisor.hpp:173
auto get_child()
Definition: supervisor.hpp:158
details::ChildState children_states_holder[children_count+1]
Definition: supervisor.hpp:180
std::tuple< Actors... > ActorsList
Definition: supervisor.hpp:164
static constexpr size_t children_count
Definition: supervisor.hpp:167
ActorsList children
Definition: supervisor.hpp:170
ActorBase * actors[children_count+1]
Definition: supervisor.hpp:177
wrapper for holding child states in supervisor
Definition: supervisor.hpp:21
State down_state
Definition: supervisor.hpp:23
State Change confirmation, from actor to supervisor.
Definition: messages.hpp:32
Idle message, refreshes time and triggers expired timers.
Definition: messages.hpp:53