MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / create_decoder_inst

Method create_decoder_inst

DSView/pv/data/decode/decoder.cpp:160–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session)
161{
162 GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash,
163 g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
164
165 for (auto i = _options.begin(); i != _options.end(); i++)
166 {
167 GVariant *const value = (*i).second;
168 g_variant_ref(value);
169 g_hash_table_replace(opt_hash, (void*)g_strdup(
170 (*i).first.c_str()), value);
171 }
172
173 srd_decoder_inst *const decoder_inst = srd_inst_new(
174 session, _decoder->id, opt_hash);
175 g_hash_table_destroy(opt_hash);
176
177 if(!decoder_inst)
178 return NULL;
179
180 // Setup the probes
181 GHashTable *const probes = g_hash_table_new_full(g_str_hash,
182 g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
183
184 for(auto it = _probes.begin(); it != _probes.end(); it++)
185 {
186 GVariant *const gvar = g_variant_new_int32((*it).second);
187 g_variant_ref_sink(gvar);
188 g_hash_table_insert(probes, (*it).first->id, gvar);
189 }
190
191 srd_inst_channel_set_all(decoder_inst, probes);
192
193 return decoder_inst;
194}
195
196
197} // decode

Callers 1

execute_decode_stackMethod · 0.80

Calls 3

srd_inst_newFunction · 0.85
srd_inst_channel_set_allFunction · 0.85
endMethod · 0.45

Tested by

no test coverage detected