+ if (segment_id >= segments_.size())
+ return;
+
+ const DecodeSegment* segment = &(segments_.at(segment_id));
+
+ auto row_it = segment->annotation_rows.find(row);
+
+ const RowData* rd;
+ if (row_it == segment->annotation_rows.end())
+ return;
+ else
+ rd = &(row_it->second);
+
+ rd->get_annotation_subset(dest, start_sample, end_sample);
+}
+
+void DecodeSignal::get_annotation_subset(deque<const Annotation*> &dest,
+ uint32_t segment_id, uint64_t start_sample, uint64_t end_sample) const
+{
+ for (const Row* row : get_rows())
+ get_annotation_subset(dest, row, segment_id, start_sample, end_sample);
+}
+
+uint32_t DecodeSignal::get_binary_data_chunk_count(uint32_t segment_id,
+ const Decoder* dec, uint32_t bin_class_id) const
+{
+ if ((segments_.size() == 0) || (segment_id >= segments_.size()))
+ return 0;
+
+ const DecodeSegment *segment = &(segments_[segment_id]);
+
+ for (const DecodeBinaryClass& bc : segment->binary_classes)
+ if ((bc.decoder == dec) && (bc.info->bin_class_id == bin_class_id))
+ return bc.chunks.size();
+
+ return 0;
+}
+
+void DecodeSignal::get_binary_data_chunk(uint32_t segment_id,
+ const Decoder* dec, uint32_t bin_class_id, uint32_t chunk_id,
+ const vector<uint8_t> **dest, uint64_t *size)
+{
+ if (segment_id >= segments_.size())
+ return;
+
+ const DecodeSegment *segment = &(segments_[segment_id]);
+
+ for (const DecodeBinaryClass& bc : segment->binary_classes)
+ if ((bc.decoder == dec) && (bc.info->bin_class_id == bin_class_id)) {
+ if (dest) *dest = &(bc.chunks.at(chunk_id).data);
+ if (size) *size = bc.chunks.at(chunk_id).data.size();
+ return;
+ }
+}
+
+void DecodeSignal::get_merged_binary_data_chunks_by_sample(uint32_t segment_id,
+ const Decoder* dec, uint32_t bin_class_id, uint64_t start_sample,
+ uint64_t end_sample, vector<uint8_t> *dest) const
+{
+ assert(dest != nullptr);
+
+ if (segment_id >= segments_.size())