rotor_light
real-time C++ actor micro-framework for embedded systems, supervisable
definitions.hpp
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2022 Ivan Baidakou
3
4#pragma once
5
6#include <cstddef>
7#include <cstdint>
8#include <limits>
9
10namespace rotor_light {
11
13enum class State { off, initializing, initialized, operational, shutting_down };
14
15namespace details {
16
17enum class StateCommand { init, start, shutdown };
18
19}
20
21// clang-format off
27enum class FailPolicy {
28 restart = 0b00000001,
29 force_restart = 0b00000011,
30 escalate = 0b00000100,
31 force_escalate = 0b00001100,
32 ignore = 0b00010000,
33};
34// clang-format on
35
36using MessageTypeId = ROTOR_LIGHT_MESSAGE;
37using Index = ROTOR_LIGHT_INDEX;
38using ActorId = ROTOR_LIGHT_ACTOR;
39using EventId = ROTOR_LIGHT_EVENT;
40
41static constexpr size_t default_queue = ROTOR_LIGHT_FW_QUEUE;
42
43static constexpr auto broadcast = std::numeric_limits<ActorId>::max();
44
45using TimePoint = ROTOR_LIGHT_TIMEPOINT;
46using Duration = ROTOR_LIGHT_DURATION;
47using NowFunction = TimePoint (*)();
48using Callback = void (*)(void *);
49
50namespace ctx {
51struct thread {};
52struct interrupt {};
53} // namespace ctx
54
55} // namespace rotor_light
Definition: definitions.hpp:52
Definition: definitions.hpp:51