EightBit/M6502/HarteTest_6502/test_t.h
Adrian Conlon 3a58bad0b0 Simplify json datatype conversions.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
2021-10-20 14:28:00 +01:00

63 lines
1.3 KiB
C++

#pragma once
#include <string>
#ifdef USE_SIMDJSON_JSON
# include "simdjson/simdjson.h"
#endif
#ifdef USE_RAPIDJSON_JSON
# include "rapidjson/document.h"
#endif
#ifdef USE_BOOST_JSON
# include <boost/json.hpp>
#endif
#ifdef USE_NLOHMANN_JSON
# include "nlohmann/json.hpp"
#endif
#ifdef USE_JSONCPP_JSON
# include <json/json.h>
#endif
#include "cycles_t.h"
#include "state_t.h"
class test_t final {
private:
std::string m_name;
state_t m_initial_state;
state_t m_final_state;
cycles_t m_cycles;
public:
#ifdef USE_SIMDJSON_JSON
test_t(simdjson::dom::element serialised);
#endif
#ifdef USE_RAPIDJSON_JSON
test_t(const rapidjson::Value& serialised);
#endif
#ifdef USE_BOOST_JSON
test_t(const boost::json::object& serialised);
test_t(const boost::json::value& serialised);
#endif
#ifdef USE_NLOHMANN_JSON
test_t(const nlohmann::json& serialised);
#endif
#ifdef USE_JSONCPP_JSON
test_t(const Json::Value& serialised);
#endif
[[nodiscard]] constexpr const auto& name() const noexcept { return m_name; }
[[nodiscard]] constexpr const auto& initial_state() const noexcept { return m_initial_state; }
[[nodiscard]] constexpr const auto& final_state() const noexcept { return m_final_state; }
[[nodiscard]] constexpr const auto& cycles() const noexcept { return m_cycles; }
};