definitions.hpp 955 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // SPDX-License-Identifier: MIT
  2. // SPDX-FileCopyrightText: 2022 Ivan Baidakou
  3. #pragma once
  4. #include <cstdint>
  5. #include <limits>
  6. namespace rotor_light {
  7. enum class State { off, initializing, initialized, operational, shutting_down };
  8. enum class StateCommand { init, start, shutdown };
  9. // clang-format off
  10. enum class FailPolicy {
  11. restart = 0b00000001,
  12. force_restart = 0b00000011,
  13. escalate = 0b00000100,
  14. force_escalate = 0b00001100,
  15. ignore = 0b00010000,
  16. };
  17. // clang-format on
  18. using MessageTypeId = uint16_t;
  19. using index_t = uint8_t;
  20. using ActorId = uint64_t;
  21. static constexpr auto broadcast = std::numeric_limits<ActorId>::max();
  22. struct MessageType {
  23. static constexpr auto undef = std::numeric_limits<MessageTypeId>::max();
  24. };
  25. using TimePoint = ROTOR_LIGHT_TIMEPOINT;
  26. using Duration = ROTOR_LIGHT_DURATION;
  27. using NowFunction = TimePoint (*)();
  28. using Callback = void (*)(void *);
  29. } // namespace rotor_light