1 #ifndef ARTDAQ_TRANSFERPLUGINS_DETAIL_HOSTMAP_HH
2 #define ARTDAQ_TRANSFERPLUGINS_DETAIL_HOSTMAP_HH
7 #include "fhiclcpp/ParameterSet.h"
8 #include "artdaq/TransferPlugins/TransferInterface.hh"
17 typedef std::map<int, DestinationInfo> hostMap_t;
19 inline std::vector<fhicl::ParameterSet> MakeHostMapPset(std::map<int, DestinationInfo> input)
21 std::vector<fhicl::ParameterSet> output;
22 for (
auto& rank : input)
24 fhicl::ParameterSet rank_output;
25 rank_output.put<
int>(
"rank", rank.first);
26 rank_output.put<std::string>(
"host", rank.second.hostname);
27 rank_output.put<
int>(
"portOffset", rank.second.portOffset);
28 output.push_back(rank_output);
33 inline hostMap_t MakeHostMap(fhicl::ParameterSet pset,
int masterPortOffset = 0, hostMap_t output = hostMap_t())
35 if (pset.has_key(
"host_map")) {
36 auto hosts = pset.get<std::vector<fhicl::ParameterSet>>(
"host_map");
37 for (
auto& ps : hosts)
41 info.hostname = ps.get<std::string>(
"host",
"localhost");
42 info.portOffset = ps.get<
int>(
"portOffset", 5500) + masterPortOffset;
44 if (output.count(rank) && (output[rank].hostname != info.hostname || output[rank].portOffset != info.portOffset))
46 TLOG(TLVL_ERROR) <<
"Inconsistent host maps supplied! Check configuration! There may be TCPSocket-related failures!";
Value to be returned upon receive timeout.