MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / annotation_callback

Method annotation_callback

DSView/pv/data/decoderstack.cpp:780–838  ·  view source on GitHub ↗

the decode callback, annotation object will be create

Source from the content-addressed store, hash-verified

778
779//the decode callback, annotation object will be create
780void DecoderStack::annotation_callback(srd_proto_data *pdata, void *self)
781{
782 assert(pdata);
783 assert(self);
784
785 struct decode_task_status *st = (decode_task_status*)self;
786
787 DecoderStack *const d = st->_decoder;
788 assert(d);
789
790 if (st->_bStop){
791 return;
792 }
793 if (d->_decoder_status == NULL){
794 dsv_err("decode task was deleted.");
795 assert(false);
796 }
797
798 if (d->_no_memory) {
799 return;
800 }
801
802 Annotation *a = new Annotation(pdata, d->_decoder_status);
803 if (a == NULL){
804 d->_no_memory = true;
805 return;
806 }
807 d->_result_count++;
808
809 // Find the row
810 assert(pdata->pdo);
811 assert(pdata->pdo->di);
812 const srd_decoder *const decc = pdata->pdo->di->decoder;
813 assert(decc);
814
815 auto row_iter = d->_rows.end();
816
817 // Try looking up the sub-row of this class
818 const map<pair<const srd_decoder*, int>, Row>::const_iterator r =
819 d->_class_rows.find(make_pair(decc, a->format()));
820 if (r != d->_class_rows.end())
821 row_iter = d->_rows.find((*r).second);
822 else
823 {
824 // Failing that, use the decoder as a key
825 row_iter = d->_rows.find(Row(decc));
826 }
827
828 assert(row_iter != d->_rows.end());
829 if (row_iter == d->_rows.end()) {
830 dsv_err("Unexpected annotation: decoder = 0x%x, format = %d", (void*)decc, a->format());
831 assert(0);
832 return;
833 }
834
835 // Add the annotation
836 if (!(*row_iter).second->push_annotation(a))
837 d->_no_memory = true;

Callers

nothing calls this directly

Calls 4

push_annotationMethod · 0.80
RowClass · 0.50
endMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected