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

Method PrepareForWriting

lib/mdflib/mdflib/src/cg3block.cpp:225–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225bool Cg3Block::PrepareForWriting() {
226 try {
227 nof_channels_ = static_cast<uint16_t>(cn_list_.size());
228 uint64_t record_size = 0;
229 size_of_data_record_ = 0;
230 for (auto &cn3 : cn_list_) {
231 cn3->ByteOffset(static_cast<uint32_t>(record_size));
232 record_size += cn3->DataBytes();
233 size_of_data_record_ = static_cast<uint16_t>(record_size);
234 }
235 if (record_size > 0xFFFF) {
236 throw std::runtime_error("The record size is to large. Size; "
237 + std::to_string(record_size) + " > " + std::to_string(0xFFFF));
238 }
239 sample_buffer_.resize(static_cast<size_t>(record_size));
240
241 } catch (const std::exception &err) {
242 MDF_ERROR() << "Failed to prepare for writing. Error: " << err.what();
243 return false;
244 }
245 return true;
246}
247
248uint64_t Cg3Block::ReadDataRecord(std::streambuf& buffer,
249 const IDataGroup &notifier) const {

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.45
ByteOffsetMethod · 0.45
DataBytesMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected