MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / ReadRangeDataRecord

Method ReadRangeDataRecord

lib/mdflib/mdflib/src/cg3block.cpp:267–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267uint64_t Cg3Block::ReadRangeDataRecord(std::streambuf& buffer,
268 const IDataGroup &notifier,
269 DgRange& range) const {
270 uint64_t count;
271 const uint64_t sample = Sample();
272 const uint64_t next_sample = sample + 1;
273 const size_t record_size = size_of_data_record_;
274 CgRange* cg_range = range.GetCgRange(RecordId());
275 if (cg_range == nullptr) {
276 return 0;
277 }
278
279 if (!cg_range->IsUsed() ||
280 next_sample < range.MinSample() ||
281 next_sample > range.MaxSample()) {
282 count = StepFilePosition(buffer, record_size);
283
284 if (sample < NofSamples()) {
285 IncrementSample();
286 }
287 if (next_sample > range.MaxSample()) {
288 cg_range->IsUsed(false);
289 }
290 } else {
291 // Normal fixed length records
292
293 std::vector<uint8_t> record(record_size, 0);
294
295 count = buffer.sgetn(
296 reinterpret_cast<char*>(record.data()), record.size());
297
298 if (sample < NofSamples()) {
299 const bool continue_reading =
300 notifier.NotifySampleObservers(sample, RecordId(), record);
301 IncrementSample();
302 if (!continue_reading) {
303 return 0; // Indicating no more reading
304 }
305 }
306 }
307
308 return count;
309}
310IChannel *Cg3Block::CreateChannel() {
311 auto cn3 = std::make_unique<detail::Cn3Block>();
312 cn3->Init(*this);

Callers 1

ParseRangeDataRecordsMethod · 0.80

Calls 8

StepFilePositionFunction · 0.85
GetCgRangeMethod · 0.80
MinSampleMethod · 0.80
MaxSampleMethod · 0.80
NotifySampleObserversMethod · 0.80
IsUsedMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected