diff options
| author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-01-30 10:43:49 +0100 | 
|---|---|---|
| committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-01-30 10:43:49 +0100 | 
| commit | 466833a35a402347b7e2180ab265146eb0a3a59d (patch) | |
| tree | 08e9c71325e8b8774d73cdc49b55206c15254f44 /src/ensembledatabase.cpp | |
| parent | c515439594bf939e3f712856257a5a086b57616a (diff) | |
| download | etisnoop-466833a35a402347b7e2180ab265146eb0a3a59d.tar.gz etisnoop-466833a35a402347b7e2180ab265146eb0a3a59d.tar.bz2 etisnoop-466833a35a402347b7e2180ab265146eb0a3a59d.zip | |
Fix FIB2 component labels
Diffstat (limited to 'src/ensembledatabase.cpp')
| -rw-r--r-- | src/ensembledatabase.cpp | 32 | 
1 files changed, 27 insertions, 5 deletions
| diff --git a/src/ensembledatabase.cpp b/src/ensembledatabase.cpp index e5066a6..735aca3 100644 --- a/src/ensembledatabase.cpp +++ b/src/ensembledatabase.cpp @@ -29,9 +29,11 @@  #include <locale>  #include <codecvt> +#include <iomanip>  #include <sstream>  #include "ensembledatabase.hpp"  #include "charset.hpp" +#include "utils.hpp"  namespace ensemble_database { @@ -118,9 +120,17 @@ string label_t::assemble() const  string label_t::assembly_state() const  {      stringstream ss; -    ss << "["; +    ss << "(";      for (const auto& s : segments) { -        ss << s.first << ","; +        ss << s.first; +        if (get_verbosity() > 1) { +            ss << "["; +            for (const auto& c : s.second) { +                ss << hex << setw(2) << (int)c << " "; +            } +            ss << "]" << dec; +        } +        ss << ",";      }      ss << "count=" << segment_count << ","; @@ -138,12 +148,12 @@ string label_t::assembly_state() const              ss << "UNDEFINED";              break;      } -    ss << "]"; +    ss << ")";      return ss.str();  } -component_t& service_t::get_component(uint32_t subchannel_id) +component_t& service_t::get_component_by_subchannel(uint32_t subchannel_id)  {      for (auto& component : components) {          if (component.subchId == subchannel_id) { @@ -151,10 +161,22 @@ component_t& service_t::get_component(uint32_t subchannel_id)          }      } -    throw not_found("component referring to subchannel " + +    throw not_found("component with subchannel id " +              to_string(subchannel_id) + " not found");  } +component_t& service_t::get_component_by_scids(uint8_t scids) +{ +    for (auto& component : components) { +        if (component.scids == scids) { +            return component; +        } +    } + +    throw not_found("component with SCIdS " + +            to_string(scids) + " not found"); +} +  component_t& service_t::get_or_create_component(uint32_t subchannel_id)  {      for (auto& component : components) { | 
