From ed1a35bf8bf8be0e3f3b12c2e9332dfcd86a817b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 11 May 2020 21:30:35 +0200 Subject: Update common --- lib/edi/TagPacket.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib/edi/TagPacket.cpp') diff --git a/lib/edi/TagPacket.cpp b/lib/edi/TagPacket.cpp index b0bf9a1..ec52ad7 100644 --- a/lib/edi/TagPacket.cpp +++ b/lib/edi/TagPacket.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 + Copyright (C) 2020 Matthias P. Braendli, matthias.braendli@mpb.li http://www.opendigitalradio.org @@ -41,17 +41,19 @@ TagPacket::TagPacket(unsigned int alignment) : m_alignment(alignment) std::vector TagPacket::Assemble() { - std::list::iterator tag; + if (raw_tagpacket.size() > 0 and tag_items.size() > 0) { + throw std::logic_error("TagPacket: both raw and items used!"); + } - std::vector packet; + if (raw_tagpacket.size() > 0) { + return raw_tagpacket; + } - //std::cerr << "Assemble TAGPacket" << std::endl; + std::vector packet; - for (tag = tag_items.begin(); tag != tag_items.end(); ++tag) { - std::vector tag_data = (*tag)->Assemble(); + for (auto tag : tag_items) { + std::vector tag_data = tag->Assemble(); packet.insert(packet.end(), tag_data.begin(), tag_data.end()); - - //std::cerr << " Add TAGItem of length " << tag_data.size() << std::endl; } if (m_alignment == 0) { /* no padding */ } -- cgit v1.2.3