| 577 | } |
| 578 | |
| 579 | bool MdfReader::ReadSrData(ISampleReduction &sr_group) { |
| 580 | if (!instance_ || !file_) { |
| 581 | MDF_ERROR() << "No instance created. File: " << filename_; |
| 582 | return false; |
| 583 | } |
| 584 | |
| 585 | bool shall_close = !IsOpen() && Open(); |
| 586 | if (!IsOpen()) { |
| 587 | MDF_ERROR() << "Failed to open file. File: " << filename_; |
| 588 | return false; |
| 589 | } |
| 590 | |
| 591 | bool error = false; |
| 592 | try { |
| 593 | if (instance_->IsMdf4()) { |
| 594 | auto &sr4 = dynamic_cast<detail::Sr4Block &>(sr_group); |
| 595 | sr4.ReadData(*file_); |
| 596 | } else { |
| 597 | auto &sr3 = dynamic_cast<detail::Sr3Block &>(sr_group); |
| 598 | sr3.ReadData(*file_); |
| 599 | } |
| 600 | } catch (const std::exception &err) { |
| 601 | MDF_ERROR() << "Failed to read the file information blocks. Error: " |
| 602 | << err.what(); |
| 603 | error = true; |
| 604 | } |
| 605 | |
| 606 | if (shall_close) { |
| 607 | Close(); |
| 608 | } |
| 609 | return !error; |
| 610 | } |
| 611 | |
| 612 | const IHeader *MdfReader::GetHeader() const { |
| 613 | const auto *file = GetFile(); |
no test coverage detected