X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Fanalog.cpp;h=f8fe473d3681ebc31f0850d052af2d952d8fbae4;hb=edf9f6bb11b13559afba60834be6e8d3578f03c0;hp=6e2f2db8413a2b9917f246aa59ad539dda574f29;hpb=caabb84c559023f179bf2c4600a5ebce34eab081;p=pulseview.git
diff --git a/pv/data/analog.cpp b/pv/data/analog.cpp
index 6e2f2db..f8fe473 100644
--- a/pv/data/analog.cpp
+++ b/pv/data/analog.cpp
@@ -14,15 +14,18 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see .
*/
-#include "analog.h"
-#include "analogsnapshot.h"
+#include
-using namespace boost;
-using namespace std;
+#include "analog.hpp"
+#include "analogsegment.hpp"
+
+using std::deque;
+using std::max;
+using std::shared_ptr;
+using std::vector;
namespace pv {
namespace data {
@@ -32,19 +35,61 @@ Analog::Analog() :
{
}
-void Analog::push_snapshot(shared_ptr &snapshot)
+void Analog::push_segment(shared_ptr &segment)
+{
+ segments_.push_back(segment);
+}
+
+const deque< shared_ptr >& Analog::analog_segments() const
{
- _snapshots.push_front(snapshot);
+ return segments_;
}
-deque< shared_ptr >& Analog::get_snapshots()
+vector< shared_ptr > Analog::segments() const
{
- return _snapshots;
+ return vector< shared_ptr >(
+ segments_.begin(), segments_.end());
+}
+
+uint32_t Analog::get_segment_count() const
+{
+ return (uint32_t)segments_.size();
}
void Analog::clear()
{
- _snapshots.clear();
+ segments_.clear();
+
+ samples_cleared();
+}
+
+double Analog::get_samplerate() const
+{
+ if (segments_.empty())
+ return 1.0;
+
+ return segments_.front()->samplerate();
+}
+
+uint64_t Analog::max_sample_count() const
+{
+ uint64_t l = 0;
+ for (const shared_ptr& s : segments_) {
+ assert(s);
+ l = max(l, s->get_sample_count());
+ }
+ return l;
+}
+
+void Analog::notify_samples_added(QObject* segment, uint64_t start_sample,
+ uint64_t end_sample)
+{
+ samples_added(segment, start_sample, end_sample);
+}
+
+void Analog::notify_min_max_changed(float min, float max)
+{
+ min_max_changed(min, max);
}
} // namespace data