X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fdecoderstack.cpp;h=bc26f9fccf1a93a2acaa38bea1a86621bca53687;hp=2817d29205cc8ee825c72ff049e5775ab6b638cb;hb=613d097c5af2d12ffd68e2dfab309b518edca1a6;hpb=204bae4548c295cae1d88fc4eae027a17e5a58a7 diff --git a/pv/data/decoderstack.cpp b/pv/data/decoderstack.cpp index 2817d292..bc26f9fc 100644 --- a/pv/data/decoderstack.cpp +++ b/pv/data/decoderstack.cpp @@ -71,6 +71,22 @@ void DecoderStack::push(boost::shared_ptr decoder) _stack.push_back(decoder); } +void DecoderStack::remove(int index) +{ + using pv::data::decode::Decoder; + + assert(index >= 0); + assert(index < (int)_stack.size()); + + // Find the decoder in the stack + list< shared_ptr >::iterator iter = _stack.begin(); + for(int i = 0; i < index; i++, iter++) + assert(iter != _stack.end()); + + // Delete the element + _stack.erase(iter); +} + const vector< shared_ptr > DecoderStack::annotations() const {