X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Flogic.cpp;h=167c79bd3cf2ef49e1e9db77a4f1070b38084aac;hp=7b42e47497054c3fc6d359bf3ac860bb577fc09f;hb=8bd26d8b9c831b509ee3241ea4dac6f50c023622;hpb=1b1ec774978b65209ce2b454cbf81da499b797d2 diff --git a/pv/data/logic.cpp b/pv/data/logic.cpp index 7b42e474..167c79bd 100644 --- a/pv/data/logic.cpp +++ b/pv/data/logic.cpp @@ -18,20 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #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 +53,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; + BOOST_FOREACH(boost::shared_ptr s, _snapshots) { + assert(s); + l = max(l, s->get_sample_count()); + } + return l; +} + } // namespace data } // namespace pv