diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-08-15 11:53:55 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-08-15 11:53:55 +0200 |
commit | 55a66f6408042abfd102f92fd0072a000d8e0235 (patch) | |
tree | 12269221fd70e6a2a33a9e68aeecbbfb9fed1014 /src/ConfigParser.cpp | |
parent | 3dab3da3f669e1f2c70fd81c13f67c9c5c77278a (diff) | |
download | dabmux-55a66f6408042abfd102f92fd0072a000d8e0235.tar.gz dabmux-55a66f6408042abfd102f92fd0072a000d8e0235.tar.bz2 dabmux-55a66f6408042abfd102f92fd0072a000d8e0235.zip |
Add cluster handling for announcements
Diffstat (limited to 'src/ConfigParser.cpp')
-rw-r--r-- | src/ConfigParser.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 5290b0f..7840a60 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -37,6 +37,8 @@ #endif #include <boost/property_tree/ptree.hpp> +#include <boost/algorithm/string/classification.hpp> +#include <boost/algorithm/string/split.hpp> #include <exception> #include <iostream> #include <vector> @@ -261,6 +263,32 @@ void parse_ptree(boost::property_tree::ptree& pt, } } + auto clusterlist = pt_service.get<std::string>("announcements.clusters", ""); + vector<string> clusters_s; + boost::split(clusters_s, + clusterlist, + boost::is_any_of(",")); + + for (const auto& cluster_s : clusters_s) { + if (cluster_s == "") { + continue; + } + try { + service->clusters.push_back(std::stoi(cluster_s)); + } + catch (std::logic_error& e) { + etiLog.level(warn) << "Cannot parse '" << clusterlist << + "' announcement clusters for service " << serviceuid << + ": " << e.what(); + } + } + + if (service->ASu != 0 and service->clusters.empty()) { + etiLog.level(warn) << "Cluster list for service " << serviceuid << + "is empty, but announcements are defined"; + } + + int success = -5; string servicelabel = pt_service.get<string>("label"); |