]> sigrok.org Git - pulseview.git/blobdiff - pv/data/logic.cpp
Replaced BOOST_FOREACH with C++11 range-based for loops
[pulseview.git] / pv / data / logic.cpp
index 7b42e47497054c3fc6d359bf3ac860bb577fc09f..9bcfd0a382ac39c020d396007d07a4e1885fbef8 100644 (file)
 #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 {
 
-Logic::Logic(const sr_datafeed_meta_logic &meta,
-       uint64_t samplerate) :
-       SignalData(samplerate),
-       _num_probes(meta.num_probes)
+Logic::Logic(unsigned int num_probes) :
+       SignalData(),
+       _num_probes(num_probes)
 {
+       assert(_num_probes > 0);
 }
 
 int Logic::get_num_probes() const
@@ -50,5 +51,20 @@ deque< shared_ptr<LogicSnapshot> >& Logic::get_snapshots()
        return _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