EightBit/M6502/HarteTest_6502/cycle_t.h
Adrian Conlon b70f24a581 Draw an end to my json experimentations. simdjson is king. long live simdjson!
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
2021-10-20 21:44:43 +01:00

30 lines
811 B
C++

#pragma once
#include <cstdint>
#include <string>
#include "simdjson/simdjson.h"
class cycle_t final {
public:
enum class action_t { read, write, unknown };
private:
uint16_t m_address = 0xffff;
uint8_t m_value = 0xff;
action_t m_action = action_t::unknown;
public:
[[nodiscard]] static std::string to_string(action_t value) noexcept;
[[nodiscard]] static action_t to_action(std::string value) noexcept;
cycle_t(uint16_t address, uint8_t value, action_t action) noexcept;
cycle_t(simdjson::dom::element input) noexcept;
cycle_t(simdjson::dom::array input) noexcept;
[[nodiscard]] constexpr auto address() const noexcept { return m_address; }
[[nodiscard]] constexpr auto value() const noexcept { return m_value; }
[[nodiscard]] constexpr auto action() const noexcept { return m_action; }
};