From b6b840f6072e950f2ded719ae51badfba7566fa8 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 6 Oct 2025 17:21:13 +0200 Subject: Add frequency_information hot-reload --- src/ConfigParser.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'src/ConfigParser.cpp') diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 2d500b3..efc010f 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -112,7 +112,7 @@ static void parse_fig2_label(ptree& pt, DabLabel& label) { // Parse the linkage section void parse_linkage( const boost::optional pt_linking, - std::vector >& linkageSets) + std::vector >& linkage_sets) { if (pt_linking) { for (const auto& it : *pt_linking) { @@ -189,17 +189,17 @@ void parse_linkage( linkageset->id_list.push_back(link); } } - linkageSets.push_back(linkageset); + linkage_sets.push_back(linkageset); } } } // Parse the FI section -static void parse_freq_info(ptree& pt, std::shared_ptr ensemble) +void parse_freq_info( + const boost::optional pt_frequency_information, + std::vector& frequency_information) { - auto pt_frequency_information = pt.get_child_optional("frequency_information"); - if (pt_frequency_information) - { + if (pt_frequency_information) { for (const auto& it_fi : *pt_frequency_information) { const string fi_uid = it_fi.first; const ptree pt_fi = it_fi.second; @@ -312,14 +312,14 @@ static void parse_freq_info(ptree& pt, std::shared_ptr ensemble) throw runtime_error("invalid configuration for FI " + fi_uid); } - ensemble->frequency_information.emplace_back(move(fi)); + frequency_information.emplace_back(std::move(fi)); } // for over fi /* We sort all FI to have the OE=0 first and the OE=1 afterwards, to * avoid having to send FIG0 headers every time it switches. */ std::sort( - ensemble->frequency_information.begin(), - ensemble->frequency_information.end(), + frequency_information.begin(), + frequency_information.end(), [](const FrequencyInformation& first, const FrequencyInformation& second) { const int oe_first = first.other_ensemble ? 1 : 0; @@ -332,9 +332,8 @@ static void parse_freq_info(ptree& pt, std::shared_ptr ensemble) static void parse_other_service_linking(ptree& pt, std::shared_ptr ensemble) { - auto pt_other_services = pt.get_child_optional("other-services"); - if (pt_other_services) - { + const auto pt_other_services = pt.get_child_optional("other-services"); + if (pt_other_services) { for (const auto& it_service : *pt_other_services) { const string srv_uid = it_service.first; const ptree pt_srv = it_service.second; @@ -363,7 +362,7 @@ static void parse_other_service_linking(ptree& pt, } } - ensemble->service_other_ensemble.push_back(move(info)); + ensemble->service_other_ensemble.push_back(std::move(info)); } } catch (const std::exception &e) { @@ -911,8 +910,15 @@ void parse_ptree( } const auto pt_linking = pt.get_child_optional("linking"); - parse_linkage(pt_linking, ensemble->linkagesets); - parse_freq_info(pt, ensemble); + std::vector > linkagesets; + parse_linkage(pt_linking, linkagesets); + + const auto pt_frequency_information = pt.get_child_optional("frequency_information"); + std::vector frequency_information; + parse_freq_info(pt_frequency_information, frequency_information); + + ensemble->set_linking_config(linkagesets, frequency_information); + parse_other_service_linking(pt, ensemble); } -- cgit v1.2.3