projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pv::prop::Double: Do not create a widget if the initial value could not be retrieved
[pulseview.git]
/
pv
/
prop
/
binding
/
decoderoptions.cpp
diff --git
a/pv/prop/binding/decoderoptions.cpp
b/pv/prop/binding/decoderoptions.cpp
index 0a6cd15c998604bdfad8ba9913c1fa640c6793b7..e29436768ab499d8364790cd9605335b00f810ad 100644
(file)
--- a/
pv/prop/binding/decoderoptions.cpp
+++ b/
pv/prop/binding/decoderoptions.cpp
@@
-22,21
+22,29
@@
#include "decoderoptions.h"
#include "decoderoptions.h"
+#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/none_t.hpp>
#include <pv/data/decoderstack.h>
#include <boost/foreach.hpp>
#include <boost/none_t.hpp>
#include <pv/data/decoderstack.h>
+#include <pv/data/decode/decoder.h>
#include <pv/prop/int.h>
#include <pv/prop/string.h>
#include <pv/prop/int.h>
#include <pv/prop/string.h>
-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 {
namespace pv {
namespace prop {
namespace binding {
-DecoderOptions::DecoderOptions(shared_ptr<pv::data::DecoderStack> decoder) :
+DecoderOptions::DecoderOptions(
+ shared_ptr<pv::data::DecoderStack> decoder_stack,
+ shared_ptr<data::decode::Decoder> decoder) :
+ _decoder_stack(decoder_stack),
_decoder(decoder)
{
assert(_decoder);
_decoder(decoder)
{
assert(_decoder);
@@
-73,13
+81,17
@@
DecoderOptions::DecoderOptions(shared_ptr<pv::data::DecoderStack> decoder) :
GVariant* DecoderOptions::getter(const char *id)
{
GVariant* DecoderOptions::getter(const char *id)
{
+ GVariant *val = NULL;
+
assert(_decoder);
// Get the value from the hash table if it is already present
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<string, GVariant*>& options = _decoder->options();
+
map<string, GVariant*>::const_iterator iter = options.find(
id);
- if (!val)
+ if (iter != options.end())
+ val = (*iter).second;
+ else
{
assert(_decoder->decoder());
{
assert(_decoder->decoder());
@@
-105,6
+117,9
@@
void DecoderOptions::setter(const char *id, GVariant *value)
{
assert(_decoder);
_decoder->set_option(id, value);
{
assert(_decoder);
_decoder->set_option(id, value);
+
+ assert(_decoder_stack);
+ _decoder_stack->begin_decode();
}
} // binding
}
} // binding