]> sigrok.org Git - pulseview.git/commitdiff
Session: Make get_segment_count() consider all segments
authorSoeren Apel <redacted>
Sun, 7 Jan 2018 19:15:19 +0000 (20:15 +0100)
committerUwe Hermann <redacted>
Tue, 9 Jan 2018 23:34:39 +0000 (00:34 +0100)
Also changes the type for the getters to uint32_t.

pv/data/analog.cpp
pv/data/analog.hpp
pv/data/logic.cpp
pv/data/logic.hpp
pv/data/signaldata.hpp
pv/session.cpp
pv/session.hpp

index ed15867c2734d071ab843737284fc41f63aab208..364ee5a818b57b6f82eed03473c1f5e368dd3af8 100644 (file)
@@ -51,9 +51,9 @@ vector< shared_ptr<Segment> > Analog::segments() const
                segments_.begin(), segments_.end());
 }
 
-int Analog::get_segment_count() const
+uint32_t Analog::get_segment_count() const
 {
-       return segments_.size();
+       return (uint32_t)segments_.size();
 }
 
 void Analog::clear()
index b53e7f04f4b8f5a85b1adb63f625d9ebbf8288fa..859b3e013f473fc011a5a1eb5b6a48e5f2ae6d32 100644 (file)
@@ -49,7 +49,7 @@ public:
 
        vector< shared_ptr<Segment> > segments() const;
 
-       int get_segment_count() const;
+       uint32_t get_segment_count() const;
 
        void clear();
 
index 3e194d54eecec4c54abaaeba1d0b7e029c755265..e78c28468d71ef42da07e7e0eb102076889cfd38 100644 (file)
@@ -57,9 +57,9 @@ vector< shared_ptr<Segment> > Logic::segments() const
        return vector< shared_ptr<Segment> >(segments_.begin(), segments_.end());
 }
 
-int Logic::get_segment_count() const
+uint32_t Logic::get_segment_count() const
 {
-       return segments_.size();
+       return (uint32_t)segments_.size();
 }
 
 void Logic::clear()
index a371d22bdecf1f4e6402e3223b6ac62891f324e7..d11e0cca67677b5a833ef66fb9390ed4237a406e 100644 (file)
@@ -50,7 +50,7 @@ public:
 
        vector< shared_ptr<Segment> > segments() const;
 
-       int get_segment_count() const;
+       uint32_t get_segment_count() const;
 
        void clear();
 
index adede1c211c595eefb9e108d1929cad6d9b5af0b..01dd93ab32a0819fe8a8acf2d709cd0a6945131c 100644 (file)
@@ -45,7 +45,7 @@ public:
 public:
        virtual vector< shared_ptr<Segment> > segments() const = 0;
 
-       virtual int get_segment_count() const = 0;
+       virtual uint32_t get_segment_count() const = 0;
 
        virtual void clear() = 0;
 
index fb1732bbe79a0d37e81830856aa91339b27d3744..11a867ab6f410f9e702124c4b82dac6b3e0ce6ef 100644 (file)
@@ -677,16 +677,16 @@ double Session::get_samplerate() const
        return samplerate;
 }
 
-int Session::get_segment_count() const
+uint32_t Session::get_segment_count() const
 {
-       int min_val = INT_MAX;
+       uint32_t value = 0;
 
-       // Find the lowest common number of segments
+       // Find the highest number of segments
        for (shared_ptr<data::SignalData> data : all_signal_data_)
-               if (data->get_segment_count() < min_val)
-                       min_val = data->get_segment_count();
+               if (data->get_segment_count() > value)
+                       value = data->get_segment_count();
 
-       return (min_val != INT_MAX) ? min_val : 0;
+       return value;
 }
 
 const unordered_set< shared_ptr<data::SignalBase> > Session::signalbases() const
index 8ae6673872f3c5a4804672a9a6a2b976d6b57396..6bdfaa24ffe861c27b8919571115c0de67bb6ae7 100644 (file)
@@ -163,7 +163,7 @@ public:
 
        double get_samplerate() const;
 
-       int get_segment_count() const;
+       uint32_t get_segment_count() const;
 
        void register_view(shared_ptr<views::ViewBase> view);