| 201 | } |
| 202 | |
| 203 | void Dg4Block::ReadData(std::streambuf& buffer) { |
| 204 | |
| 205 | const auto& block_list = DataBlockList(); |
| 206 | if (block_list.empty()) { |
| 207 | return; |
| 208 | } |
| 209 | InitFastObserverList(); |
| 210 | // First scan through all CN blocks and set up any VLSD CG or MLSD channel |
| 211 | // relations. |
| 212 | |
| 213 | for (const auto& cg4 : cg_list_) { |
| 214 | if (!cg4) { |
| 215 | continue; |
| 216 | } |
| 217 | |
| 218 | // Fetch all data from sample reduction blocks (SR). |
| 219 | for (const auto& sr4 : cg4->Sr4()) { |
| 220 | if (!sr4) { |
| 221 | continue; |
| 222 | } |
| 223 | sr4->ReadData(buffer); |
| 224 | } |
| 225 | |
| 226 | // Fetch all signal data (SD) |
| 227 | const auto channel_list = cg4->Channels(); |
| 228 | for (const auto* channel :channel_list) { |
| 229 | if (channel == nullptr) { |
| 230 | continue; |
| 231 | } |
| 232 | // Check if the channel is in the subscription |
| 233 | if (!IsSubscribingOnChannel(*channel) ) { |
| 234 | continue; |
| 235 | } |
| 236 | const auto* cn_block = dynamic_cast<const Cn4Block*>(channel); |
| 237 | if (cn_block == nullptr) { |
| 238 | continue; |
| 239 | } |
| 240 | // Fetch the channels referenced data block. |
| 241 | // Note that some types of |
| 242 | // data blocks are owned by this channel as a SD block, but some are only |
| 243 | // references to block own by another block. Of interest is VLSD CG block |
| 244 | // and MLSD channel. |
| 245 | const auto data_link = cn_block->DataLink(); |
| 246 | if (data_link == 0) { |
| 247 | continue; // No data to read into the system |
| 248 | } |
| 249 | const auto* block = Find(data_link); |
| 250 | if (block == nullptr) { |
| 251 | if (const auto* header = HeaderBlock(); header != nullptr) { |
| 252 | block = header->Find(data_link); |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | if (block == nullptr) { |
| 257 | MDF_DEBUG() << "Missing data block in channel. Channel :" |
| 258 | << cn_block->Name() |
| 259 | << ", Data Link: " << data_link; |
| 260 |
no test coverage detected