2021-10-18 10:54:01 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "cycles_t.h"
|
|
|
|
|
|
|
|
cycles_t::cycles_t(size_t reserved) {
|
|
|
|
m_cycles.reserve(reserved);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cycles_t::add(const cycle_t& cycle) {
|
2021-10-18 11:28:15 +00:00
|
|
|
assert(m_cycles.capacity() >= (m_cycles.size() + 1));
|
2021-10-18 10:54:01 +00:00
|
|
|
m_cycles.push_back(cycle);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_SIMDJSON_JSON
|
|
|
|
|
|
|
|
cycles_t::cycles_t(simdjson::dom::array input) {
|
2021-10-18 11:28:15 +00:00
|
|
|
assert(m_cycles.empty());
|
2021-10-18 10:54:01 +00:00
|
|
|
m_cycles.reserve(input.size());
|
|
|
|
for (const auto& entry : input)
|
|
|
|
add(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-10-18 23:39:26 +00:00
|
|
|
#ifdef USE_RAPIDJSON_JSON
|
|
|
|
|
|
|
|
cycles_t::cycles_t(const rapidjson::Value& input) {
|
|
|
|
assert(m_cycles.empty());
|
2021-10-18 23:59:02 +00:00
|
|
|
m_cycles.reserve(input.Size());
|
|
|
|
for (const auto& entry : input.GetArray())
|
2021-10-18 23:39:26 +00:00
|
|
|
add(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-10-18 10:54:01 +00:00
|
|
|
#ifdef USE_BOOST_JSON
|
|
|
|
|
|
|
|
cycles_t::cycles_t(const boost::json::value& input)
|
2021-10-18 19:40:13 +00:00
|
|
|
: cycles_t(input.get_array()) {}
|
2021-10-18 10:54:01 +00:00
|
|
|
|
|
|
|
cycles_t::cycles_t(const boost::json::array& input) {
|
2021-10-18 11:28:15 +00:00
|
|
|
assert(m_cycles.empty());
|
2021-10-18 10:54:01 +00:00
|
|
|
m_cycles.reserve(input.size());
|
|
|
|
for (const auto& entry : input)
|
|
|
|
add(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_NLOHMANN_JSON
|
|
|
|
|
|
|
|
cycles_t::cycles_t(const nlohmann::json& input) {
|
2021-10-18 11:28:15 +00:00
|
|
|
assert(m_cycles.empty());
|
2021-10-18 10:54:01 +00:00
|
|
|
m_cycles.reserve(input.size());
|
|
|
|
for (const auto& entry : input)
|
|
|
|
add(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_JSONCPP_JSON
|
|
|
|
|
|
|
|
cycles_t::cycles_t(const Json::Value& input) {
|
2021-10-18 11:28:15 +00:00
|
|
|
assert(m_cycles.empty());
|
2021-10-18 10:54:01 +00:00
|
|
|
m_cycles.reserve(input.size());
|
|
|
|
for (const auto& entry : input)
|
|
|
|
add(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|