X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdata%2Fdecode%2Fdecoder.cpp;h=3b75f88482e6ec3bc5613471f3dfde9d40a826e1;hb=04394ded8776d2163c1e815ccc8170b81d76b028;hp=374dd4d360c9bf8bca84f544eaf04892395c9888;hpb=da50281d69f15d125b56971a3009fd31cbbab58b;p=pulseview.git diff --git a/pv/data/decode/decoder.cpp b/pv/data/decode/decoder.cpp index 374dd4d3..3b75f884 100644 --- a/pv/data/decode/decoder.cpp +++ b/pv/data/decode/decoder.cpp @@ -25,7 +25,7 @@ #include "decoder.hpp" -#include +#include using std::set; using std::map; @@ -44,7 +44,7 @@ Decoder::Decoder(const srd_decoder *const dec) : Decoder::~Decoder() { - for (auto & option : options_) + for (auto& option : options_) g_variant_unref(option.second); } @@ -63,14 +63,14 @@ void Decoder::show(bool show) shown_ = show; } -const map >& +const map >& Decoder::channels() const { return channels_; } void Decoder::set_channels(std::map > channels) + std::shared_ptr > channels) { channels_ = channels; } @@ -102,10 +102,10 @@ bool Decoder::have_required_channels() const set< shared_ptr > Decoder::get_data() { set< shared_ptr > data; - for (const auto & channel : channels_) { - shared_ptr signal(channel.second); - assert(signal); - data.insert(signal->logic_data()); + for (const auto& channel : channels_) { + shared_ptr b(channel.second); + assert(b); + data.insert(b->logic_data()); } return data; @@ -116,7 +116,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_variant_unref); - for (const auto & option : options_) { + for (const auto& option : options_) { GVariant *const value = option.second; g_variant_ref(value); g_hash_table_replace(opt_hash, (void*)g_strdup( @@ -134,10 +134,9 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const GHashTable *const channels = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_variant_unref); - for (const auto & channel : channels_) { - shared_ptr signal(channel.second); - GVariant *const gvar = g_variant_new_int32( - signal->channel()->index()); + for (const auto& channel : channels_) { + shared_ptr b(channel.second); + GVariant *const gvar = g_variant_new_int32(b->index()); g_variant_ref_sink(gvar); g_hash_table_insert(channels, channel.first->id, gvar); }