SRS-control 0.1.4
 
Loading...
Searching...
No Matches
DataWriterOptions.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4
6
7namespace srs
8{
9 enum class DataWriterOption : uint8_t
10 {
11
12 no_output = 0x00,
13 root = 0x01,
14 json = 0x02,
15 bin = 0x04,
16 udp = 0x10,
17 };
18
19 inline auto get_filetype_from_filename(std::string_view filename)
20 -> std::tuple<DataWriterOption, process::DataConvertOptions>
21 {
22 using enum DataWriterOption;
24 namespace fs = std::filesystem;
25
26 if (auto pos = filename.find(':'); pos != std::string::npos)
27 {
28 return { udp, proto };
29 }
30
31 const auto file_ext = fs::path{ filename }.extension().string();
32 if (file_ext == ".bin" or file_ext == ".lmd")
33 {
34 return { bin, raw_frame };
35 }
36 if (file_ext == ".binpb")
37 {
38 return { bin, proto_frame };
39 }
40 if (file_ext == ".root")
41 {
42 return { root, structure };
43 }
44 if (file_ext == ".json")
45 {
46 return { json, structure };
47 }
48
49 return { no_output, none };
50 }
51
52} // namespace srs
auto get_filetype_from_filename(std::string_view filename) -> std::tuple< DataWriterOption, process::DataConvertOptions >