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

Function buildSnapshotTables

app/src/API/Handlers/ProjectHandler.cpp:3795–3815  ·  view source on GitHub ↗

* @brief Builds the data-tables summary array used by project.snapshot. */

Source from the content-addressed store, hash-verified

3793 * @brief Builds the data-tables summary array used by project.snapshot.
3794 */
3795static QJsonArray buildSnapshotTables(const DataModel::ProjectModel& pm)
3796{
3797 QJsonArray tables;
3798 for (const auto& t : pm.tables()) {
3799 QJsonObject tbl;
3800 tbl[Keys::Title] = t.name;
3801 tbl[QStringLiteral("registerCount")] = static_cast<int>(t.registers.size());
3802
3803 const auto constants = std::count_if(t.registers.begin(), t.registers.end(), [](const auto& r) {
3804 return r.type == DataModel::RegisterType::Constant;
3805 });
3806 const auto computed = std::count_if(t.registers.begin(), t.registers.end(), [](const auto& r) {
3807 return r.type == DataModel::RegisterType::Computed;
3808 });
3809
3810 tbl[QStringLiteral("constantCount")] = static_cast<int>(constants);
3811 tbl[QStringLiteral("computedCount")] = static_cast<int>(computed);
3812 tables.append(tbl);
3813 }
3814 return tables;
3815}
3816
3817/**
3818 * @brief Returns project.snapshot's caller hint, with a bulk-edit nudge above 10 datasets.

Callers 1

projectSnapshotMethod · 0.85

Calls 3

beginMethod · 0.80
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected