Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * create_binary_record_format — factory for binary record I/O formats.
5 *
6 * Supported: "qe" (Fortran unformatted), "q3" (raw sequential).
7 */
8
9#include <memory>
10#include <stdexcept>
11#include <string>
12
14#include "io/checkpoint/q3.hpp"
15#include "io/checkpoint/qe.hpp"
16
17namespace q3 {
18
19/// Create a binary record format by name.
20inline std::unique_ptr<BinaryRecordFormat>
21create_binary_record_format(const std::string& format_name = "qe") {
22 if (format_name == "qe") {
23 return std::make_unique<QEBinaryRecordFormat>();
24 }
25 if (format_name == "q3") {
26 return std::make_unique<Q3BinaryRecordFormat>();
27 }
28 throw std::runtime_error("Unknown binary record format: " + format_name);
29}
30
31} // namespace q3
std::unique_ptr< BinaryRecordFormat > create_binary_record_format(const std::string &format_name="qe")
Create a binary record format by name.
Definition factory.hpp:21