| 265 | } |
| 266 | |
| 267 | uint64_t Cg3Block::ReadRangeDataRecord(std::streambuf& buffer, |
| 268 | const IDataGroup ¬ifier, |
| 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 | } |
| 310 | IChannel *Cg3Block::CreateChannel() { |
| 311 | auto cn3 = std::make_unique<detail::Cn3Block>(); |
| 312 | cn3->Init(*this); |
no test coverage detected