diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-07-03 08:05:36 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-07-03 08:05:36 +0200 |
commit | f99c4f75d7c1ffc18e3d04167e854af3d571f1b1 (patch) | |
tree | 8cf60c877a0fa1b9519895a66d6c013786e88d4a /src/DabMultiplexer.cpp | |
parent | 191721eaecbc14fc65928c87dcccab9383d55200 (diff) | |
download | dabmux-f99c4f75d7c1ffc18e3d04167e854af3d571f1b1.tar.gz dabmux-f99c4f75d7c1ffc18e3d04167e854af3d571f1b1.tar.bz2 dabmux-f99c4f75d7c1ffc18e3d04167e854af3d571f1b1.zip |
Add dumb reconfigure to DabMultiplexer
Diffstat (limited to 'src/DabMultiplexer.cpp')
-rw-r--r-- | src/DabMultiplexer.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index 413e034..5c41d99 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -25,6 +25,7 @@ #include "DabMultiplexer.h" #include "ConfigParser.h" +#include <boost/make_shared.hpp> using namespace std; using namespace boost; @@ -88,7 +89,7 @@ DabMultiplexer::DabMultiplexer( { prepare_watermark(); - ensemble = boost::shared_ptr<dabEnsemble>(new dabEnsemble); + ensemble = boost::make_shared<dabEnsemble>(); } void DabMultiplexer::prepare_watermark() @@ -118,13 +119,16 @@ void DabMultiplexer::prepare_watermark() void DabMultiplexer::update_config(boost::property_tree::ptree pt) { - ensemble->services.clear(); - ensemble->components.clear(); - ensemble->subchannels.clear(); + ensemble_next = boost::make_shared<dabEnsemble>(); - m_pt = pt; + m_pt_next = pt; - prepare(); + reconfigure(); +} + +void DabMultiplexer::reconfigure() +{ + parse_ptree(m_pt_next, ensemble_next, m_rc, &edi_conf); } // Run a set of checks on the configuration @@ -195,16 +199,15 @@ void DabMultiplexer::prepare() void DabMultiplexer::prepare_subchannels() { set<unsigned char> ids; - vector<dabSubchannel*>::iterator subchannel; - for (subchannel = ensemble->subchannels.begin(); - subchannel != ensemble->subchannels.end(); - ++subchannel) { - if (ids.find((*subchannel)->id) != ids.end()) { + + for (auto subchannel : ensemble->subchannels) { + if (ids.find(subchannel->id) != ids.end()) { etiLog.log(error, "Subchannel %u is set more than once!\n", - (*subchannel)->id); + subchannel->id); throw MuxInitException(); } + ids.insert(subchannel->id); } } |