25#include <msgpack_light/output_stream.h>
26#include <msgpack_light/serialize.h>
38class MsgpackOutputFileStream :
public msgpack_light::output_stream {
45 explicit MsgpackOutputFileStream(
const std::string& file_path)
46 : file_(std::fopen(file_path.c_str(),
"wb")) {}
48 MsgpackOutputFileStream(
const MsgpackOutputFileStream&) =
delete;
49 MsgpackOutputFileStream(MsgpackOutputFileStream&&) =
delete;
50 auto operator=(
const MsgpackOutputFileStream&)
51 -> MsgpackOutputFileStream& =
delete;
52 auto operator=(MsgpackOutputFileStream&&)
53 -> MsgpackOutputFileStream& =
delete;
58 ~MsgpackOutputFileStream() { (void)std::fclose(file_); }
66 void write(
const unsigned char* data, std::size_t size)
override {
67 if (std::fwrite(data, 1, size, file_) != size) {
68 throw StatBenchException(
"Failed to write data.");
84 MsgpackOutputFileStream stream{file_path};
85 msgpack_light::serialize_to(stream, data);
DataFileReporterBase(std::string file_path)
Constructor.
MsgPackReporter(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.
Helper of MsgPack data files.
Definition of MsgPackReporter class.
Namespace of reporters of results of benchmarks.
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.