| 342 | } |
| 343 | |
| 344 | void Dg4Block::ReadRangeData(std::streambuf& buffer, DgRange& range) { |
| 345 | const auto& block_list = DataBlockList(); |
| 346 | if (block_list.empty()) { |
| 347 | return; |
| 348 | } |
| 349 | |
| 350 | InitFastObserverList(); |
| 351 | |
| 352 | // First scan through all CN blocks and set up any VLSD CG or MLSD channel |
| 353 | // relations. |
| 354 | for (const auto& cg4 : cg_list_) { |
| 355 | if (!cg4) { |
| 356 | continue; |
| 357 | } |
| 358 | const uint64_t record_id = cg4->RecordId(); |
| 359 | const bool cg_used = range.IsUsed(record_id); |
| 360 | // Do not read SD or SD data if the channel group isn't requested. |
| 361 | if (!cg_used) { |
| 362 | continue; |
| 363 | } |
| 364 | // Fetch all data from sample reduction blocks (SR), but only if the |
| 365 | // channel group data is subscribed. |
| 366 | for (const auto& sr4 : cg4->Sr4()) { |
| 367 | if (!sr4) { |
| 368 | continue; |
| 369 | } |
| 370 | sr4->ReadData(buffer); |
| 371 | } |
| 372 | |
| 373 | // Fetch all signal data (SD) |
| 374 | const auto channel_list = cg4->Channels(); |
| 375 | for (const auto* channel :channel_list) { |
| 376 | if (channel == nullptr) { |
| 377 | continue; |
| 378 | } |
| 379 | // Check if the channel is in the subscription |
| 380 | if (!IsSubscribingOnChannel(*channel) ) { |
| 381 | continue; |
| 382 | } |
| 383 | const auto* cn_block = dynamic_cast<const Cn4Block*>(channel); |
| 384 | if (cn_block == nullptr) { |
| 385 | continue; |
| 386 | } |
| 387 | // Fetch the channels referenced data block. Note that some types of |
| 388 | // data blocks are owned by this channel as an SD block, but some are only |
| 389 | // references to block own by another block. Of interest is VLSD CG block |
| 390 | // and MLSD channel. |
| 391 | const auto data_link = cn_block->DataLink(); |
| 392 | if (data_link == 0) { |
| 393 | continue; // No data to read into the system |
| 394 | } |
| 395 | const auto* block = Find(data_link); |
| 396 | if (block == nullptr) { |
| 397 | MDF_DEBUG() << "Missing data block in channel. Channel :" |
| 398 | << cn_block->Name() |
| 399 | << ", Data Link: " << data_link; |
| 400 | |
| 401 | continue; // Strange that the block doesn't exist |
nothing calls this directly
no test coverage detected