Quantum 3xplorer (Q3)
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
13
#include "
io/checkpoint/init.hpp
"
14
#include "
io/checkpoint/q3.hpp
"
15
#include "
io/checkpoint/qe.hpp
"
16
17
namespace
q3
{
18
19
/// Create a binary record format by name.
20
inline
std::unique_ptr<BinaryRecordFormat>
21
create_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
q3.hpp
qe.hpp
init.hpp
q3
Definition
q3_core_api.hpp:33
q3::create_binary_record_format
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
src
io
checkpoint
factory.hpp
Generated by
1.9.8