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

Method seedNextUniqueIdFromGroups

app/src/DataModel/ProjectModel.cpp:758–783  ·  view source on GitHub ↗

* @brief Back-fills missing uniqueIds and bumps the allocator past every assigned uid. */

Source from the content-addressed store, hash-verified

756 * @brief Back-fills missing uniqueIds and bumps the allocator past every assigned uid.
757 */
758void DataModel::ProjectModel::seedNextUniqueIdFromGroups()
759{
760 int maxUid = 0;
761
762 for (auto& group : m_groups) {
763 for (auto& dataset : group.datasets) {
764 if (dataset.uniqueId < 0)
765 dataset.uniqueId = dataset_unique_id(group.sourceId, dataset.groupId, dataset.datasetId);
766
767 if (dataset.uniqueId > maxUid)
768 maxUid = dataset.uniqueId;
769 }
770
771 if (group.uniqueId > maxUid)
772 maxUid = group.uniqueId;
773 }
774
775 if (m_nextUniqueId <= maxUid)
776 m_nextUniqueId = maxUid + 1;
777
778 for (auto& group : m_groups)
779 if (group.uniqueId < 0)
780 group.uniqueId = m_nextUniqueId++;
781
782 deduplicateUniqueIds();
783}
784
785/**
786 * @brief Enforces globally unique dataset+group uniqueIds across all sources. Downstream

Callers

nothing calls this directly

Calls 1

dataset_unique_idFunction · 0.85

Tested by

no test coverage detected