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

Method captureLatestChannelSpans

app/src/DataModel/FrameBuilder.cpp:639–656  ·  view source on GitHub ↗

* @brief Span-lane twin of captureLatestChannels: in-place UTF-8 writes into the reused token * list keep the capture allocation-free in steady state. @p count is span-lane bounded. */

Source from the content-addressed store, hash-verified

637 * list keep the capture allocation-free in steady state. @p count is span-lane bounded.
638 */
639void DataModel::FrameBuilder::captureLatestChannelSpans(int sourceId,
640 const QByteArrayView* spans,
641 qsizetype count)
642{
643 Q_ASSERT(spans != nullptr);
644 Q_ASSERT(m_captureLatestFrame);
645 Q_ASSERT(count > 0 && count <= kMaxSpanFields);
646
647 const auto it = m_latestFrames.find(sourceId);
648 if (it == m_latestFrames.end()) [[unlikely]]
649 return;
650
651 it->channels.resize(count);
652 for (qsizetype i = 0; i < count; ++i)
653 DataModel::assign_utf8_in_place(it->channels[i], spans[i]);
654
655 it->channelsSequence = it->sequence;
656}
657
658/**
659 * @brief Dispatches a captured chunk to the parser for the current operation mode.

Callers

nothing calls this directly

Calls 3

assign_utf8_in_placeFunction · 0.85
findMethod · 0.80
resizeMethod · 0.45

Tested by

no test coverage detected