21 void initialize()
override {
22 const std::string & path = getPath();
23 const std::string & subpath = getSubpath();
24 openBinaryArchiveFile_(path, subpath);
27 const std::vector<double> & readFromSource()
override {
31 static const size_t BUF_LEN = 10000;
32 static const size_t BUF_NUM_BYTES = BUF_LEN *
sizeof(double);
34 values_.resize(BUF_LEN);
35 char * buffer =
reinterpret_cast<char*
>(&values_[0]);
36 binary_fin_.read(buffer, BUF_NUM_BYTES);
37 auto actual_bytes_read = binary_fin_.gcount();
44 values_.resize(actual_bytes_read /
sizeof(
double));
49 void openBinaryArchiveFile_(
const std::string & path,
50 const std::string & subpath)
52 const std::string filename = path +
"/" + subpath +
"/values.bin";
53 binary_fin_.open(filename, std::ios::binary);
56 "Unable to open archive file for read: ") << filename;
60 std::ifstream binary_fin_;
61 std::vector<double> values_;