Replaced BOOST_FOREACH with C++11 range-based for loops
[pulseview.git] / pv / data / logic.cpp
index c62a2f2e3ad693833b1a55dbac3977d72c62deb5..9bcfd0a382ac39c020d396007d07a4e1885fbef8 100644 (file)
@@ -21,8 +21,9 @@
 #include "logic.h"
 #include "logicsnapshot.h"
 
-using namespace boost;
-using namespace std;
+using boost::shared_ptr;
+using std::deque;
+using std::max;
 
 namespace pv {
 namespace data {
@@ -50,10 +51,20 @@ deque< shared_ptr<LogicSnapshot> >& Logic::get_snapshots()
        return _snapshots;
 }
 
-void Logic::clear_snapshots()
+void Logic::clear()
 {
        _snapshots.clear();
 }
 
+uint64_t Logic::get_max_sample_count() const
+{
+       uint64_t l = 0;
+       for (boost::shared_ptr<LogicSnapshot> s : _snapshots) {
+               assert(s);
+               l = max(l, s->get_sample_count());
+       }
+       return l;
+}
+
 } // namespace data
 } // namespace pv