X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Flogic.cpp;h=2737bcb58238870b63066231778ca674c6231e25;hb=f9abf97e78bc4825d80926b0ebc6cbaef40768b1;hp=7b42e47497054c3fc6d359bf3ac860bb577fc09f;hpb=1b1ec774978b65209ce2b454cbf81da499b797d2;p=pulseview.git diff --git a/pv/data/logic.cpp b/pv/data/logic.cpp index 7b42e47..2737bcb 100644 --- a/pv/data/logic.cpp +++ b/pv/data/logic.cpp @@ -21,17 +21,18 @@ #include "logic.h" #include "logicsnapshot.h" -using namespace boost; -using namespace std; +using std::deque; +using std::max; +using std::shared_ptr; 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 >& Logic::get_snapshots() return _snapshots; } +void Logic::clear() +{ + _snapshots.clear(); +} + +uint64_t Logic::get_max_sample_count() const +{ + uint64_t l = 0; + for (std::shared_ptr s : _snapshots) { + assert(s); + l = max(l, s->get_sample_count()); + } + return l; +} + } // namespace data } // namespace pv