]> sigrok.org Git - pulseview.git/commitdiff
Expose length of valid data in segment chunk
authorJon Burgess <redacted>
Sat, 13 Oct 2018 21:26:25 +0000 (22:26 +0100)
committerUwe Hermann <redacted>
Tue, 16 Oct 2018 21:37:19 +0000 (23:37 +0200)
pv/data/segment.cpp
pv/data/segment.hpp

index 6ea17ff6d0ba2861af7d3963538771e51d2159e6..ef555292a61a902fbea973298008f0c0bbcd89d3 100644 (file)
@@ -289,5 +289,13 @@ uint8_t* Segment::get_iterator_value(SegmentDataIterator* it)
        return (it->chunk + it->chunk_offs);
 }
 
+uint64_t Segment::get_iterator_valid_length(SegmentDataIterator* it)
+{
+       assert(it->sample_index <= (sample_count_ - 1));
+
+       return ((chunk_size_ - it->chunk_offs) / unit_size_);
+}
+
+
 } // namespace data
 } // namespace pv
index 4c6c36af3c3b0c0b6245ae0e257a2f1000992ae2..f5a00c9581530529044cb33d283f52cbb7c1d162 100644 (file)
@@ -90,6 +90,7 @@ protected:
        void continue_sample_iteration(SegmentDataIterator* it, uint64_t increase);
        void end_sample_iteration(SegmentDataIterator* it);
        uint8_t* get_iterator_value(SegmentDataIterator* it);
+       uint64_t get_iterator_valid_length(SegmentDataIterator* it);
 
        uint32_t segment_id_;
        mutable recursive_mutex mutex_;