16 DetectorType detector_type{DetectorType::Reserved};
17 ReadoutType readout_type{ReadoutType::CAEN};
18 std::string ip_address{};
47 void parse(
const std::string & json_text);
49 [[nodiscard]]
bool empty() const noexcept {
return configs.empty(); }
50 [[nodiscard]] std::size_t size() const noexcept {
return configs.size(); }
52 [[nodiscard]]
bool contains(DetectorType detector_type, ReadoutType readout_type)
const;
54 [[nodiscard]] std::optional<SenderConfig>
find(DetectorType detector_type, ReadoutType readout_type)
const;
56 [[nodiscard]]
const SenderConfig &
at(DetectorType detector_type, ReadoutType readout_type)
const;
59 using key_type = std::pair<DetectorType, ReadoutType>;
61 std::map<key_type, SenderConfig> configs{};
Explicit EFU endpoint configuration for replay, parsed from JSON.
void parse(const std::string &json_text)
Replace the held configurations with those parsed from json_text.
const SenderConfig & at(DetectorType detector_type, ReadoutType readout_type) const
The endpoint for the pair; throws std::out_of_range when not configured.
SenderConfigs(const std::string &json_text)
Equivalent to from_json().
static SenderConfigs from_file(const std::filesystem::path &path)
Read and parse a JSON file; throws std::runtime_error if unreadable or invalid.
static SenderConfigs from_json(const std::string &json_text)
Parse a JSON document; throws std::runtime_error describing the first invalid entry.
bool contains(DetectorType detector_type, ReadoutType readout_type) const
True when an endpoint is configured for the pair.
std::optional< SenderConfig > find(DetectorType detector_type, ReadoutType readout_type) const
The endpoint for the pair, or std::nullopt when not configured.
One Event Formation Unit endpoint for a (detector, readout) pair.