MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / WriteSignalData

Method WriteSignalData

lib/mdflib/mdflib/src/mdf4writer.cpp:108–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106
107
108bool 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
143Dg4Block* Mdf4Writer::GetLastDg4() {
144 auto *header = Header();

Callers

nothing calls this directly

Calls 5

HeaderClass · 0.50
LastDataGroupMethod · 0.45
ChannelGroupsMethod · 0.45
ChannelsMethod · 0.45
ClearDataMethod · 0.45

Tested by

no test coverage detected