EightBit/M6502/HarteTest_6502/ram_t.cpp

66 lines
1.2 KiB
C++
Raw Normal View History

#include "stdafx.h"
#include "ram_t.h"
void ram_t::add(byte_t byte) {
assert(m_bytes.capacity() >= (m_bytes.size() + 1));
m_bytes.push_back(byte);
}
#ifdef USE_SIMDJSON_JSON
ram_t::ram_t(simdjson::dom::array input) {
assert(m_bytes.empty());
m_bytes.reserve(input.size());
for (auto entry : input)
add(entry);
}
#endif
#ifdef USE_RAPIDJSON_JSON
ram_t::ram_t(const rapidjson::Value& input) {
assert(m_bytes.empty());
m_bytes.reserve(input.Size());
for (const auto& entry : input.GetArray())
add(entry);
}
#endif
#ifdef USE_BOOST_JSON
ram_t::ram_t(const boost::json::array& input) {
assert(m_bytes.empty());
m_bytes.reserve(input.size());
for (const auto& entry : input)
add(entry);
}
ram_t::ram_t(const boost::json::value& input)
2021-10-18 19:40:13 +00:00
: ram_t(input.get_array()) {}
#endif
#ifdef USE_NLOHMANN_JSON
ram_t::ram_t(const nlohmann::json& input) {
assert(m_bytes.empty());
2021-10-18 19:40:13 +00:00
m_bytes.reserve(input.size());
for (const auto& entry : input)
add(entry);
}
#endif
#ifdef USE_JSONCPP_JSON
ram_t::ram_t(const Json::Value& input) {
assert(m_bytes.empty());
2021-10-18 19:40:13 +00:00
m_bytes.reserve(input.size());
for (const auto& entry : input)
add(entry);
}
#endif