26#include <fmt/format.h>
27#include <nlohmann/json.hpp>
43 std::ofstream stream{file_path};
46 fmt::format(FMT_STRING(
"Failed to open {}."), file_path));
49 auto json_data = nlohmann::json(data);
52 constexpr int indent = 2;
53 constexpr char indent_char =
' ';
54 constexpr bool ensure_ascii =
true;
55 stream << json_data.dump(indent, indent_char, ensure_ascii);
Class of exceptions in this library.
DataFileReporterBase(std::string file_path)
Constructor.
void write_data_file(const std::string &file_path, const data_file_spec::RootData &data) override
Write a data file.
JsonReporter(std::string file_path)
Constructor.
Definition of data_file_schema_url constant.
Helper of JSON data files.
Definition of JsonReporter class.
Namespace of reporters of results of benchmarks.
constexpr std::string_view data_file_schema_url
URL of the schema of data files.
void prepare_directory_for(const std::string &path)
Prepare a directory for a file.
Namespace of stat_bench source codes.
Declaration of prepare_directory function.
Definition of StatBenchException class.
Struct of root objects in data files.