diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-06-21 21:56:59 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-06-21 22:10:44 +0200 |
commit | 1328d62f9d3a2eb9f089d531614302005c29ec37 (patch) | |
tree | 17c179b21813f3dbea0d83535d0523dd411908f8 /src/MuxElements.cpp | |
parent | 711f52b5a1f114ae911d0e072498c81831c0b814 (diff) | |
download | dabmux-1328d62f9d3a2eb9f089d531614302005c29ec37.tar.gz dabmux-1328d62f9d3a2eb9f089d531614302005c29ec37.tar.bz2 dabmux-1328d62f9d3a2eb9f089d531614302005c29ec37.zip |
Replace MGMT socket by ZMQ, make services shared_ptr
Diffstat (limited to 'src/MuxElements.cpp')
-rw-r--r-- | src/MuxElements.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index 0a52f0b..4bd82cd 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -191,19 +191,19 @@ vector<DabComponent*>::iterator getComponent( return getComponent(components, serviceId, components.end()); } -vector<DabService*>::iterator getService( +std::vector<std::shared_ptr<DabService> >::iterator getService( DabComponent* component, - vector<DabService*>& services) + std::vector<std::shared_ptr<DabService> >& services) { - vector<DabService*>::iterator service; - - for (service = services.begin(); service != services.end(); ++service) { - if ((*service)->id == component->serviceId) { - break; + size_t i = 0; + for (auto service : services) { + if (service->id == component->serviceId) { + return services.begin() + i; } + i++; } - return service; + throw std::runtime_error("Service not included in any component"); } bool DabComponent::isPacketComponent(vector<dabSubchannel*>& subchannels) |