]> sigrok.org Git - pulseview.git/commitdiff
Factored out feed_in_logic
authorJoel Holdsworth <redacted>
Thu, 13 Dec 2012 22:40:22 +0000 (22:40 +0000)
committerJoel Holdsworth <redacted>
Thu, 20 Dec 2012 08:02:44 +0000 (08:02 +0000)
pv/sigsession.cpp
pv/sigsession.h

index 3566807e633fe07f14e2b587362e29bbd6a24d44..b9ccc2b613d9d06f84a4ebab7caa2aa2eb8d0ab0 100644 (file)
@@ -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<mutex> lock(_data_mutex);
+       if (!_cur_logic_snapshot)
+       {
+               // Create a new data snapshot
+               _cur_logic_snapshot = shared_ptr<LogicDataSnapshot>(
+                       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<mutex> lock(_data_mutex);
                assert(packet->payload);
-               if (!_cur_logic_snapshot)
-               {
-                       // Create a new data snapshot
-                       _cur_logic_snapshot = shared_ptr<LogicDataSnapshot>(
-                               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:
        {
index 15e247b5953938c72f1e3c0639f8cae8ad031644..42cac0f61e1472fb056aef816b34399b2585932e 100644 (file)
@@ -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);