From: Joel Holdsworth Date: Sat, 29 Nov 2014 18:40:46 +0000 (+0000) Subject: SignalData: Added snapshots accessor method X-Git-Tag: pulseview-0.3.0~396 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=99503171d4f32570829df171521b4b9cbccb0503;p=pulseview.git SignalData: Added snapshots accessor method --- diff --git a/pv/data/analog.cpp b/pv/data/analog.cpp index dba99253..3f96dae1 100644 --- a/pv/data/analog.cpp +++ b/pv/data/analog.cpp @@ -26,6 +26,7 @@ using std::deque; using std::max; using std::shared_ptr; +using std::vector; namespace pv { namespace data { @@ -45,6 +46,12 @@ const deque< shared_ptr >& Analog::analog_snapshots() const return snapshots_; } +vector< shared_ptr > Analog::snapshots() const +{ + return vector< shared_ptr >( + snapshots_.begin(), snapshots_.end()); +} + void Analog::clear() { snapshots_.clear(); diff --git a/pv/data/analog.hpp b/pv/data/analog.hpp index c0c6bd6f..9551afff 100644 --- a/pv/data/analog.hpp +++ b/pv/data/analog.hpp @@ -42,6 +42,8 @@ public: const std::deque< std::shared_ptr >& analog_snapshots() const; + std::vector< std::shared_ptr > snapshots() const; + void clear(); uint64_t get_max_sample_count() const; diff --git a/pv/data/logic.cpp b/pv/data/logic.cpp index 8b864f76..96f0d1fe 100644 --- a/pv/data/logic.cpp +++ b/pv/data/logic.cpp @@ -26,6 +26,7 @@ using std::deque; using std::max; using std::shared_ptr; +using std::vector; namespace pv { namespace data { @@ -53,6 +54,12 @@ const deque< shared_ptr >& Logic::logic_snapshots() const return snapshots_; } +vector< shared_ptr > Logic::snapshots() const +{ + return vector< shared_ptr >( + snapshots_.begin(), snapshots_.end()); +} + void Logic::clear() { snapshots_.clear(); diff --git a/pv/data/logic.hpp b/pv/data/logic.hpp index a5185071..d57df0cf 100644 --- a/pv/data/logic.hpp +++ b/pv/data/logic.hpp @@ -24,7 +24,6 @@ #include "signaldata.hpp" #include -#include namespace pv { namespace data { @@ -44,6 +43,8 @@ public: const std::deque< std::shared_ptr >& logic_snapshots() const; + std::vector< std::shared_ptr > snapshots() const; + void clear(); uint64_t get_max_sample_count() const; diff --git a/pv/data/signaldata.hpp b/pv/data/signaldata.hpp index 885f8435..35b1305f 100644 --- a/pv/data/signaldata.hpp +++ b/pv/data/signaldata.hpp @@ -21,11 +21,15 @@ #ifndef PULSEVIEW_PV_DATA_SIGNALDATA_H #define PULSEVIEW_PV_DATA_SIGNALDATA_H -#include +#include +#include +#include namespace pv { namespace data { +class Snapshot; + class SignalData { public: @@ -38,6 +42,8 @@ public: double get_start_time() const; + virtual std::vector< std::shared_ptr > snapshots() const = 0; + virtual void clear() = 0; virtual uint64_t get_max_sample_count() const = 0;