Loading...
Searching...
No Matches
init.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * BinaryRecordFormat — abstract interface for binary record I/O formats.
5 *
6 * Defines the contract for writing and reading framed binary records.
7 * Concrete implementations handle the specific byte-level framing:
8 * - QE: Fortran unformatted sequential [4-byte len][data][4-byte len]
9 * - Q3: raw sequential (no framing, just raw bytes)
10 *
11 * Use create_binary_record_format() from factory.hpp to obtain an instance.
12 */
13
14#include <cstdint>
15#include <fstream>
16
17namespace q3 {
18
20 public:
21 virtual ~BinaryRecordFormat() = default;
22
23 /**
24 * Write a single framed record to the output stream.
25 */
26 virtual void
27 write_record(std::ofstream& output_file, const void* data, int32_t number_of_bytes) const = 0;
28
29 /**
30 * Read a single framed record from the input stream.
31 */
32 virtual void
33 read_record(std::ifstream& input_file, void* data, int32_t number_of_bytes) const = 0;
34};
35
36} // namespace q3
virtual void read_record(std::ifstream &input_file, void *data, int32_t number_of_bytes) const =0
virtual void write_record(std::ofstream &output_file, const void *data, int32_t number_of_bytes) const =0
virtual ~BinaryRecordFormat()=default