From: Joel Holdsworth Date: Thu, 13 Dec 2012 22:40:22 +0000 (+0000) Subject: Factored out feed_in_logic X-Git-Tag: pulseview-0.1.0~194 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9c11267166672b9ef174ca9313c02987364f68aa;p=pulseview.git Factored out feed_in_logic --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 3566807e..b9ccc2b6 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -206,6 +206,26 @@ void SigSession::feed_in_meta_logic(const struct sr_dev_inst *sdi, } } +void SigSession::feed_in_logic(const sr_datafeed_logic &logic) +{ + lock_guard lock(_data_mutex); + if (!_cur_logic_snapshot) + { + // Create a new data snapshot + _cur_logic_snapshot = shared_ptr( + new LogicDataSnapshot(logic)); + _logic_data->push_snapshot(_cur_logic_snapshot); + } + else + { + // Append to the existing data snapshot + _cur_logic_snapshot->append_payload(logic); + } + + data_updated(); +} + + void SigSession::data_feed_in(const struct sr_dev_inst *sdi, const struct sr_datafeed_packet *packet) { @@ -227,27 +247,9 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi, break; case SR_DF_LOGIC: - { - lock_guard lock(_data_mutex); assert(packet->payload); - if (!_cur_logic_snapshot) - { - // Create a new data snapshot - _cur_logic_snapshot = shared_ptr( - new LogicDataSnapshot( - *(sr_datafeed_logic*)packet->payload)); - _logic_data->push_snapshot(_cur_logic_snapshot); - } - else - { - // Append to the existing data snapshot - _cur_logic_snapshot->append_payload( - *(sr_datafeed_logic*)packet->payload); - } - - data_updated(); + feed_in_logic(*(const sr_datafeed_logic*)packet->payload); break; - } case SR_DF_END: { diff --git a/pv/sigsession.h b/pv/sigsession.h index 15e247b5..42cac0f6 100644 --- a/pv/sigsession.h +++ b/pv/sigsession.h @@ -84,6 +84,8 @@ private: void feed_in_meta_logic(const struct sr_dev_inst *sdi, const sr_datafeed_meta_logic &meta_logic); + void feed_in_logic(const sr_datafeed_logic &logic); + void data_feed_in(const struct sr_dev_inst *sdi, const struct sr_datafeed_packet *packet);