| 106 | |
| 107 | |
| 108 | bool Mdf4Writer::WriteSignalData(std::streambuf& buffer) { |
| 109 | |
| 110 | const auto *header = Header(); |
| 111 | if (header == nullptr) { |
| 112 | MDF_ERROR() << "No header block found. File: " << Name(); |
| 113 | return false; |
| 114 | } |
| 115 | |
| 116 | // Only the last DG block is updated. So go to the last DT |
| 117 | const auto *last_dg = header->LastDataGroup(); |
| 118 | if (last_dg == nullptr) { |
| 119 | return true; |
| 120 | } |
| 121 | |
| 122 | auto cg_list = last_dg->ChannelGroups(); |
| 123 | for (auto* group : cg_list) { |
| 124 | if (group == nullptr) { |
| 125 | continue; |
| 126 | } |
| 127 | auto cn_list = group->Channels(); |
| 128 | for (auto* channel : cn_list) { |
| 129 | if (channel == nullptr) { |
| 130 | continue; |
| 131 | } |
| 132 | auto* cn4 = dynamic_cast<Cn4Block*>(channel); |
| 133 | if (cn4 == nullptr) { |
| 134 | continue; |
| 135 | } |
| 136 | cn4->WriteSignalData(buffer, CompressData()); |
| 137 | cn4->ClearData(); |
| 138 | } |
| 139 | } |
| 140 | return true; |
| 141 | } |
| 142 | |
| 143 | Dg4Block* Mdf4Writer::GetLastDg4() { |
| 144 | auto *header = Header(); |
nothing calls this directly
no test coverage detected