25 std::ifstream fileStream(
path, std::ios::in);
26 if (!fileStream.is_open()) {
27 LOGP(error,
"Cannot open '{}'!",
path);
30 rapidjson::IStreamWrapper isw(fileStream);
31 rapidjson::Document doc;
33 if (doc.HasParseError()) {
34 LOGP(error,
"Error parsing provided json file '{}':",
path);
35 LOGP(error,
" - Error -> {}", rapidjson::GetParseError_En(doc.GetParseError()));
36 LOGP(error,
" - Offset -> {}", doc.GetErrorOffset());
43 for (
auto verItr = doc.MemberBegin(); verItr != doc.MemberEnd(); ++verItr) {
44 const auto&
version = verItr->name.GetString();
46 const auto& elements = doc[
version];
47 for (
const auto& ele : elements.GetArray()) {
48 list.emplace_back(ele.GetString());
52 }
catch (
const std::exception& e) {
53 LOGP(error,
"Failed to build detector map from file '{}' with '{}'",
path, e.what());