DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
protocols_enum.hpp
Go to the documentation of this file.
1
9#ifndef SNBMODULES_INCLUDE_SNBMODULES_COMMON_PROTOCOLS_ENUM_HPP_
10#define SNBMODULES_INCLUDE_SNBMODULES_COMMON_PROTOCOLS_ENUM_HPP_
11
12#include <map>
13#include <optional>
14#include <string>
15
16namespace dunedaq::snbmodules {
18{
27
29 {
30 const std::map<e_protocol_type, std::string> MyEnumStrings{
31 { BITTORRENT, "BITTORRENT" }, { RCLONE, "RCLONE" }, { SCP, "SCP" }, { dummy, "dummy" }
32 };
33 auto it = MyEnumStrings.find(e);
34 return it == MyEnumStrings.end() ? "Not supported" : it->second;
35 }
36
37 static std::optional<e_protocol_type> string_to_protocols(std::string s)
38 {
39 const std::map<std::string, e_protocol_type> MyStringsEnum{
40 { "BITTORRENT", BITTORRENT }, { "RCLONE", RCLONE }, { "SCP", SCP }, { "dummy", dummy }
41 };
42 auto it = MyStringsEnum.find(s);
43 if (it == MyStringsEnum.end()) {
44 return std::nullopt;
45 }
46 return it->second;
47 }
48};
49
50} // namespace dunedaq::snbmodules
51#endif // SNBMODULES_INCLUDE_SNBMODULES_COMMON_PROTOCOLS_ENUM_HPP_
static std::optional< e_protocol_type > string_to_protocols(std::string s)
e_protocol_type
Different type of protocols available for communication.
static std::string protocols_to_string(e_protocol_type e)