* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#include <limits>
+
#include "logic.hpp"
#include "logicsegment.hpp"
#include "decodesignal.hpp"
#include <pv/session.hpp>
using std::make_shared;
+using std::min;
using std::shared_ptr;
using pv::data::decode::Decoder;
using pv::data::decode::Row;
return state;
}
+void DecodeSignal::begin_decode()
+{
+ decoder_stack_->begin_decode();
+}
+
QString DecodeSignal::error_message() const
{
return decoder_stack_->error_message();
decoder_stack_->begin_decode();
}
+double DecodeSignal::samplerate() const
+{
+ return decoder_stack_->samplerate();
+}
+
+const pv::util::Timestamp& DecodeSignal::start_time() const
+{
+ return decoder_stack_->start_time();
+}
+
+int64_t DecodeSignal::get_working_sample_count() const
+{
+ // The working sample count is the highest sample number for
+ // which all used signals have data available, so go through
+ // all channels and use the lowest overall sample count of the
+ // current segment
+
+ // TODO Currently, we assume only a single segment exists
+
+ int64_t count = std::numeric_limits<int64_t>::max();
+ bool no_signals_assigned = true;
+
+ for (const data::DecodeChannel &ch : channels_)
+ if (ch.assigned_signal) {
+ no_signals_assigned = false;
+
+ const shared_ptr<Logic> logic_data = ch.assigned_signal->logic_data();
+ if (!logic_data || logic_data->logic_segments().empty())
+ return 0;
+
+ const shared_ptr<LogicSegment> segment = logic_data->logic_segments().front();
+ count = min(count, (int64_t)segment->get_sample_count());
+ }
+
+ return (no_signals_assigned ? 0 : count);
+}
+
+int64_t DecodeSignal::get_decoded_sample_count() const
+{
+ return decoder_stack_->samples_decoded();
+}
+
vector<Row> DecodeSignal::visible_rows() const
{
return decoder_stack_->get_visible_rows();