X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fdecoderoptions.cpp;h=e29436768ab499d8364790cd9605335b00f810ad;hb=5be76b1a8c3b4975c02f685ceaa02cdb69d1dccc;hp=5ad7e3562e6150e057c9299964069af1e931feba;hpb=4e5a4405482a296ebb6014e627298ad156c78d55;p=pulseview.git diff --git a/pv/prop/binding/decoderoptions.cpp b/pv/prop/binding/decoderoptions.cpp index 5ad7e356..e2943676 100644 --- a/pv/prop/binding/decoderoptions.cpp +++ b/pv/prop/binding/decoderoptions.cpp @@ -22,21 +22,29 @@ #include "decoderoptions.h" +#include #include #include -#include +#include +#include #include #include -using namespace boost; -using namespace std; +using boost::bind; +using boost::none; +using boost::shared_ptr; +using std::map; +using std::string; namespace pv { namespace prop { namespace binding { -DecoderOptions::DecoderOptions(shared_ptr decoder) : +DecoderOptions::DecoderOptions( + shared_ptr decoder_stack, + shared_ptr decoder) : + _decoder_stack(decoder_stack), _decoder(decoder) { assert(_decoder); @@ -73,13 +81,17 @@ DecoderOptions::DecoderOptions(shared_ptr decoder) : GVariant* DecoderOptions::getter(const char *id) { + GVariant *val = NULL; + assert(_decoder); // Get the value from the hash table if it is already present - GVariant *val = (GVariant*)g_hash_table_lookup( - (GHashTable*)_decoder->options(), id); + const map& options = _decoder->options(); + map::const_iterator iter = options.find(id); - if (!val) + if (iter != options.end()) + val = (*iter).second; + else { assert(_decoder->decoder()); @@ -105,6 +117,9 @@ void DecoderOptions::setter(const char *id, GVariant *value) { assert(_decoder); _decoder->set_option(id, value); + + assert(_decoder_stack); + _decoder_stack->begin_decode(); } } // binding