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

Function slotForAnchor

app/src/DataModel/ProjectModel.cpp:3662–3685  ·  view source on GitHub ↗

* @brief Re-resolves a RefAnchor into a per-type slot index in the given group. * Returns -1 if the anchor's dataset is not present. */

Source from the content-addressed store, hash-verified

3660 * Returns -1 if the anchor's dataset is not present.
3661 */
3662static int slotForAnchor(const detail::RefAnchor& a, const DataModel::Group& g)
3663{
3664 if (a.datasetFrameIndex < 0)
3665 return -1;
3666
3667 int slot = 0;
3668 for (const auto& d : g.datasets) {
3669 const auto keys = SerialStudio::getDashboardWidgets(d);
3670 for (const auto& k : keys) {
3671 if (static_cast<int>(k) != a.widgetType)
3672 continue;
3673
3674 if (!SerialStudio::datasetWidgetEligibleForWorkspace(k))
3675 continue;
3676
3677 if (d.index == a.datasetFrameIndex)
3678 return slot;
3679
3680 slot += 1;
3681 }
3682 }
3683
3684 return -1;
3685}
3686
3687/**
3688 * @brief Snapshots one anchor per workspace ref before a reorder.

Callers 1

resolveOneWorkspaceRefsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected