X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fdecoderoptions.cpp;h=e29436768ab499d8364790cd9605335b00f810ad;hb=f352b9bbeafc33fab0d003573b86ceed17565b5e;hp=0a6cd15c998604bdfad8ba9913c1fa640c6793b7;hpb=6e89374a6796f8d5d9cc61b0a2f7e98562a034ae;p=pulseview.git diff --git a/pv/prop/binding/decoderoptions.cpp b/pv/prop/binding/decoderoptions.cpp index 0a6cd15..e294367 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 -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