2021-10-18 10:54:01 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
|
2021-10-20 20:44:43 +00:00
|
|
|
#include "simdjson/simdjson.h"
|
2021-10-18 10:54:01 +00:00
|
|
|
|
|
|
|
class cycle_t final {
|
|
|
|
private:
|
2021-10-20 22:06:42 +00:00
|
|
|
const uint16_t m_address = 0xffff;
|
|
|
|
const uint8_t m_value = 0xff;
|
|
|
|
const std::string m_action;
|
2021-10-18 10:54:01 +00:00
|
|
|
|
|
|
|
public:
|
2021-10-20 22:06:42 +00:00
|
|
|
cycle_t(uint16_t address, uint8_t value, std::string action) noexcept;
|
2021-10-18 10:54:01 +00:00
|
|
|
|
2021-10-18 16:19:28 +00:00
|
|
|
cycle_t(simdjson::dom::element input) noexcept;
|
|
|
|
cycle_t(simdjson::dom::array input) noexcept;
|
2021-10-18 10:54:01 +00:00
|
|
|
|
|
|
|
[[nodiscard]] constexpr auto address() const noexcept { return m_address; }
|
|
|
|
[[nodiscard]] constexpr auto value() const noexcept { return m_value; }
|
2021-10-20 22:06:42 +00:00
|
|
|
[[nodiscard]] auto action() const noexcept { return m_action; }
|
2021-10-18 10:54:01 +00:00
|
|
|
};
|